cordova-plugin-camera icon indicating copy to clipboard operation
cordova-plugin-camera copied to clipboard

iOS: Adding black background on PNG

Open adamalexander opened this issue 7 years ago • 9 comments

Situation: I use the plugin, to chose a png file form my camera roll. and display it in an <img> tag using the FILE_URI

Expected Behaviour: The transparent background on the png image gets replaced with a white background.

Actual Behaviour: The transparent background on the png image gets replaced with a BLACK background.

adamalexander avatar Sep 15 '18 05:09 adamalexander

Does this happen to all transparent pngs or only a special one? Why the expected white background? Is the <img> on a white background? Can you download and inspect the resulting file and look if the transparency is gone and replaced with black?

janpio avatar Sep 15 '18 14:09 janpio

This happens to all pngs with transparent backgrounds. I expected a white background I guess because it's most common? I think most people would expect a white background instead of a black when converting a png to any jpg or the sorts. The <img> is in a div that has a white background (is this what you mean?). And yes, after inspecting and downloading the image, it has black instead of transparent or white.

adamalexander avatar Sep 15 '18 14:09 adamalexander

@janpio have you come across any solutions?

adamalexander avatar Sep 17 '18 06:09 adamalexander

No, my guess (without actually looking at the code) is that this is the default behavior of whatever code is used to read the png and convert it to the end result image - you should probably have a look at the code yourself.

I am also not 100% sure it would be a general expectation that this is converted into image on white, so I am not sure if this should be changed.

janpio avatar Sep 17 '18 08:09 janpio

Same here, not resolved?

BYOLARIS avatar Aug 02 '19 14:08 BYOLARIS