News for hackers. Stuff that matters.
Re:FLIF – Free Lossless Image Format by matzipan on Monday March 07, 2016 @07:20AM (#11238460)
Does anybody understand how lossless JPEG works? To my mind, the whole point of JPEG is to get rid of high-frequency components.
Re:FLIF – Free Lossless Image Format by pjc50 on Monday March 07, 2016 @07:32AM (#11238496)
https://en.wikipedia.org/wiki/Lossless_JPEG

It's a completely different algorithm, surprisingly, based around "predictors" from nearby previously-decoded pixels. Quite like Floyd-Steinberg dithering.

Re:FLIF – Free Lossless Image Format by Houshalter on Monday March 07, 2016 @09:23AM (#11238986)
This isn't how it actually works, but one way to turn a lossy decoder into a lossy one, is to send a diff of the actual pixels vs the encoded ones. Since the lossy compression will be close to correct, the diff will mostly be small values or 0's. Which is much easier to compress.

Likewise you can turn any lossless compressor into a lossy one, by modifying the pixels that are the hardest to compress. E.g. if there is a random red pixel in a group of blue pixels, you can make it blue, and save up to 3 bytes. Or you can discard color information that humans aren't very sensitive too anyway, like JPEG does. All lossless means is that the compression isn't required by the format itself.

Re:FLIF – Free Lossless Image Format by tambourine_man on Monday March 07, 2016 @09:50AM (#11239161)
Kind of. Have you tried running a PNG compressor on a JPEG file?

It is smaler than a straight to PNG file but nowhere near the size of the original JPG.

Re:FLIF – Free Lossless Image Format by Houshalter on Monday March 07, 2016 @01:08PM (#11240376)
Well of course, JPEG artifacts aren't necessarily going to be easier for png to compress. You need to make modifications designed for png's algorithm. There are some tools that do this:

https://pngmini.com/lossypng.html

https://pngquant.org/

https://tinypng.com/

The resulting png's are much smaller. Though not necessarily as small as JPEG, it's in the same ballpark.

Re:FLIF – Free Lossless Image Format by bartvk on Tuesday March 08, 2016 @02:16AM (#11243934)
pngquant is pretty awesome, especially for screenshots. For example a screenshot of my terminal running dd, it reduces the size from 88K to 17Kbytes.