lossless jpeg compression

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
lasandcris
Posts: 2
Joined: 2016-12-19T05:47:15-07:00
Authentication code: 1151

lossless jpeg compression

Post by lasandcris »

Hi,

There might be a simple answer to this but looking through the docs and the forum I could find an answer. What is equal to setting the flag to lossless jpeg output? Does this mean 100% quality and no sub-sampling? Or is there something more to it?

thanks,
laszlo
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: lossless jpeg compression

Post by glennrp »

There is more to it. You must install a JPEG library that is capable of lossless compression/decompression, then use "-quality 100" to use it. See https://en.wikipedia.org/wiki/Lossless_JPEG. The WEBP, JPEG-LS, and JPEG-2000 libraries support lossless JPEG. But if you need lossless compression you're probably better off using a lossless format such as PNG, TIFF, PPM, or some RAW format.
lasandcris
Posts: 2
Joined: 2016-12-19T05:47:15-07:00
Authentication code: 1151

Re: lossless jpeg compression

Post by lasandcris »

@glennrp - thanks for your reply. just to put it into perspective, I've built libjpeg and want to get the same result as ImageMagick lossless jpeg compression. libjpeg gives examples on how to compress to jpeg including the one I mentioned - 100% quality and no sub-sampling - which seems to be their highest quality settings. But I wonder if this is the same as ImageMagick's lossless compression.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: lossless jpeg compression

Post by glennrp »

Regular JPEG with quality 100 is "almost lossless". You probably cannot see the difference but you can measure it.
Post Reply