alextanhongpin / compress.js

A simple JavaScript based client-side image compression algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transparency lost on png images

tri613 opened this issue · comments

Hi,

Thanks for this awesome library, it's very handy and simple.
However, if I try to compress a png image with transparency,
the transparent parts would turn into black as result.

Is there anyway to solve this?

Thanks for all the good works again!

P.S. This is what looks like on the demo page, the original image is here.
08_x_08_17-05-43

Unfortunately, I couldn't manage to work it out. It's a known issue as PNG is already a compressed data format. Therefore, the code I wrote will convert the images to JPEG in order to perform compression, which results in the loss of transparency. I'll probably add a note at the README so that others know about this issue.

I see. Thanks!