Page 1 of 1

Extract JPEG from JPG Compressed Tif

Posted: 2014-11-19T03:17:22-07:00
by jaffamuffin
Hi all

I've used scantailor to process some images and it outputs the files in TIF (JPEG) format (LZW, deflate, packbit, none or JPEG)

Can imagemagick extract the JPEG data and write to a JPEG file without having to re-compress the data within ? I.e. a lossless conversion from JPEG compressed TIF to just JPEG ?

I wrote a small python script that successfully extracted the JPG byte data from TIF (oldJPEG) but I don't think that works for newer JPG TIF as I understand they hold the 'tables' in a different part of the file and it's not a simple wrapper -- hence if imagemagick 'understands' the file, maybe it can rip the JPG data out to a new file ?

Or any other utils ?

Thanks

Re: Extract JPEG from JPG Compressed Tif

Posted: 2014-11-19T03:57:43-07:00
by snibgo
A simple test ...

Code: Select all

F:\web\im>%IM%convert logo: -compress jpeg l.tiff

F:\web\im>%IM%convert l.tiff j.jpg

F:\web\im>%IM%compare -metric RMSE l.tiff j.jpg NULL:
1459.72 (0.0222738)
... shows that, as expected, IM unpacks the jpeg then re-packs it.

I expect some tool can do this, but I don't know of one.

Re: Extract JPEG from JPG Compressed Tif

Posted: 2014-11-19T06:57:49-07:00
by jaffamuffin
Thanks for the confirmation. It's probably workable, but obviously not ideal.