brunobar79 / J-I-C

J I C is a Javascript Image Compressor using HTML5 Canvas & File API that allows you to compress your jpeg & png images before uploading to the server (100% client-side and no extra libraries required!)
http://makeitsolutions.com/labs/jic/
MIT License
857 stars 196 forks source link

Not working with png, should allow only jpg #42

Open tomermes opened 8 years ago

tomermes commented 8 years ago

The compress function allows choosing mimetype, but when using png the images only get bigger.

liltinkerer commented 8 years ago

Indeed. PNG files just get bigger instead of compression. Tested on Chrome.

skinTest commented 7 years ago

in the demo page, the 2.7 mb after process will grow to 3.1 mb, which drives me crazy

TheNicholasNick commented 7 years ago

PNG needs an option to change its kind to PNG-8, usually good enough for screenshots, which is what I wanted to use this library for.

hishosho commented 6 years ago

canvas.toDataURL(type, encoderOptions): encoderOptions only can used to image/jpeg or image/webp. This is illustrated on the MDN. https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL