Donaldcwl / browser-image-compression

Image compression in web browser
MIT License
1.3k stars 160 forks source link

Transparent PNG -> jpeg shows black background. #119

Closed zehawki closed 3 years ago

zehawki commented 3 years ago

Transparent PNG -> jpeg shows black background.

Should be white, thats the accepted approach for such conversion.

I see this happening with any transparent PNG, when converted to jpeg shows black. Eg https://www.transparentpng.com/download/happy-st-patricks-day-_34433.html produces:

image

Donaldcwl commented 3 years ago

For a transparent png file with jpeg file extension, the previous version produces a black background. In version 1.0.16, the new behavior will result in white background. Thanks.

nikkimoreaux commented 3 years ago

Hi! Great little utility thank you! Just a suggestion, white background should always apply to PNG > JPEG conversions; currently v1.0.16 doesn't use white background with the fileType: 'image/jpeg' option. Have a nice day!

Donaldcwl commented 3 years ago

@nikkimoreaux Will apply this in the next version, thanks!!