Optimal way to process jpegs

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
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Optimal way to process jpegs

Post by holden »

Processing jpegs is of course lossy, so I was thinking of converting the jpeg to IM's format (mif?), doing the operations, then saving as a jpeg- the worked mif would be discarded. Does this sound like a smart thing to do? And if so what is the best way to code it? Also the original image could be tif, png, psd, gif- mostly jpegs though. The operations include resize, rotate, crop, profile, autolevel, sharpen, composite.Thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Optimal way to process jpegs

Post by snibgo »

Strictly speaking, the losses occur when saving as jpeg. If your processing involves saving and reading temporary intermediate results, yes, a lossless format gives best quality. Miff is usually the fastest to read and write.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Optimal way to process jpegs

Post by fmw42 »

If your commands are all in one command line, IM is using MIFF internally already between steps, so you save nothing by saving to MIFF on disk. As snibgo says, the losses occur when saving to jpg.
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Optimal way to process jpegs

Post by holden »

Interesting- I can use tiff as the final file in my workflow, perhaps saving to tiff would be the best route then.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Optimal way to process jpegs

Post by fmw42 »

Perhaps, but you may not be able to compress it to as small a size as jpg. Similarly you could use PNG for your output. So make the files smaller you could convert to 8-bit color (-type palette or -colors 256) or for png (PNG8:image.png)
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Optimal way to process jpegs

Post by holden »

Thanks fmw, I'll do some testing to see if it's worth the hassle to use a different file format- the final image is going to print and will get deleted eventually so file size may not be an issue.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Optimal way to process jpegs

Post by snibgo »

Tiff has a number of compression options, including jpeg (which is lossy) and zip (lossless). I generally find that zip gives me the smallest lossless 16-bit compression.

I use jpeg only when I really have to. If one of your processing steps is to send the image to a printer, does lossy 8-bit jpeg give you any advantages? I doubt it. However, the difference in quality may not be noticable.
snibgo's IM pages: im.snibgo.com
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Optimal way to process jpegs

Post by holden »

snibgo wrote:I use jpeg only when I really have to. If one of your processing steps is to send the image to a printer, does lossy 8-bit jpeg give you any advantages? I doubt it. However, the difference in quality may not be noticable.
I'm not sure if the machines will handle a zipped tiff, or even 16-bit images, as our current print management software doesn't so it hasn't been tested extensively, something that is now on my todo list. I'll have to research the complexities of tiff as well, I know it has a ton of options at save time.
Post Reply