Glavo / SimplePNG

A zero-dependency minimalist Java library for creating PNG files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Large size difference between original and output

javasuns opened this issue · comments

Hello,

First I would like to say a big Thank You for this library. It is the first library that can create PNG images from JavaFX Images with zero dependency on AWT.
I have tested the library on small images (500x500), and input/output files had almost identical sizes.
However, I have noticed though that when I ran the library on a larger image(2304x1536) with default compression (9), there is a great difference between the original image and the created one.

image

Any ideas?

commented

Your original image is in JPEG format, which is using a lossy compression algorithm, so the compression ratio is higher.

PNG only uses the deflate compression algorithm, which is a lossless compression algorithm based on LZ77. Your output image size is less than half of the original data (2304*1536*4 = 13824KiB), which is expected.

Oh, yes you are right. Didn’t notice that detail. Is there an implementation of SimpleJPEG library? :)

commented

Oh, yes you are right. Didn’t notice that detail. Is there an implementation of SimpleJPEG library? :)

Unfortunately, there seems to be no such library.