how to upload png with transparent background to cloudinary
I am trying to upload a png image with transparent background to cloudinary using nodejs application
The image is in png format i.e. logo.png. I am using multer to get the image convert into buffer before uploading the image.
But when I upload the image the transparent background changes to a white background.
The response I am getting is : https://res.cloudinary.com/dscycqmhw/image/upload/<stuff>/pbbbybdfxzyxcm51qb2t.png
The code is as follows :
module.exports.uploadBufferDataToCloudinary = async (buffer, folder) => {
const uploadResult = await new Promise((resolve, reject) => {
cloudinary.uploader
.upload_stream(
{
upload_preset: "Codefeast",
folder: `Codefeast/${folder}`,
},
(error, uploadResult) => {
if (error) return reject(error);
return resolve(uploadResult);
}
)
.end(buffer);
});
return uploadResult;
};
Answers
-
Hi there,
I don't see any action in your upload preset that will create a transparent background:
You can read here about all the possible ways to remove the background from an image: https://support.cloudinary.com/hc/en-us/articles/202520312-Does-Cloudinary-support-removing-the-background-from-a-given-image-
Plus, please note the image was deleted.
Thanks,
Tamara
0