Does libjpeg-turbo work with existing JPG images?

70 views
Skip to first unread message

AseemGautam

unread,
Mar 27, 2018, 5:54:24 AM3/27/18
to libjpeg-turbo User Discussion/Support
Does this library work only on uncompressed - original images? Compressing jpg files seem to throw an error - 
Unrecognized input file format --- perhaps you need -targa

Seem to work fine on decompressed jpg's.

DRC

unread,
Mar 27, 2018, 11:39:44 AM3/27/18
to libjpeg-t...@googlegroups.com
JPEG images cannot be re-compressed without first decompressing them,
and bear in mind that every decompression/re-compression cycle will
incur generation loss. It would be useless to, for instance, try to
re-compress a JPEG image at a higher quality than the quality at which
it was originally compressed.

However, you can use jpegtran to losslessly transform the JPEG image--
manipulating the DCT coefficients in frequency space without first
decompressing them to image space. There is only a limited amount you
can do in frequency space. You can generally only re-arrange the DCT
coefficient blocks, discard some of the DCT coefficients, or re-encode
them using another form of entropy coding. Thus you can generally only
flip, rotate, transpose, crop along DCT block boundaries, convert to
grayscale, manipulate image markers, and convert between baseline,
progressive and arithmetic entropy coding using lossless transforms.

On 3/27/18 4:54 AM, AseemGautam wrote:
> Does this library work only on uncompressed - original images?
> Compressing jpg files seem to throw an error - 
> /Unrecognized input file format --- perhaps you need -targa/
> /
> /
Reply all
Reply to author
Forward
0 new messages