Extract JPEG from JPG Compressed Tif

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jaffamuffin
Posts: 59
Joined: 2009-01-30T03:46:08-07:00

Extract JPEG from JPG Compressed Tif

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Extract JPEG from JPG Compressed Tif

Post 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.
snibgo's IM pages: im.snibgo.com
jaffamuffin
Posts: 59
Joined: 2009-01-30T03:46:08-07:00

Re: Extract JPEG from JPG Compressed Tif

Post by jaffamuffin »

Thanks for the confirmation. It's probably workable, but obviously not ideal.
Post Reply