JPG Image Quality Loss - what do I do???

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
longjk
Posts: 2
Joined: 2012-03-08T19:25:18-07:00
Authentication code: 8675308

JPG Image Quality Loss - what do I do???

Post by longjk »

I am new to IM and tryign to create a flop of an jpg, and concatenate the orginal and the flopped image back together. Script below:

convert %%a -flop %%a
convert %%a -flop b.jpg
montage %%a b.jpg -mode Concatenate -tile 2x %%a
del b.jpg

The script works, but I loss image quality on some of the jpgs (others work fine). Any ideas how to fix? PLEASE I need your help...

Thanks,

John
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG Image Quality Loss - what do I do???

Post by fmw42 »

JPG is a lossy compression. So use something like PNG for any intermediate step that you have to save.

but there is a simpler way (in windows syntax)

convert image.jpg ( -clone 0 -flop ) +append result.jpg

see parenthesis processing and clones and append at:
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/basics/#seq_combine
http://www.imagemagick.org/script/comma ... rn7#append
longjk
Posts: 2
Joined: 2012-03-08T19:25:18-07:00
Authentication code: 8675308

Re: JPG Image Quality Loss - what do I do???

Post by longjk »

Thanks for the response. Do you happen know of anyway to accomplish this task in a batch process and keep the image quality? -Thanks so much...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG Image Quality Loss - what do I do???

Post by fmw42 »

You could script a loop to process every image in some directory with the above command. This is the only way I know. I could script this in Unix/bash, but I am not a Windows user nor do I program DOS shell/Bat scripts.

The only suggestion again is to avoid saving too many times to jpg and to use -quality to control compression vs quality. Or use lossless jpg (JP2 format) or something such as GIF or PNG.
Last edited by fmw42 on 2012-03-08T21:52:05-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: JPG Image Quality Loss - what do I do???

Post by anthony »

GIF is far from 'lossless' for non-cartoon-like images. Its saving grace is its ubiquitous availability and use for animations on web pages.

PNG is the way to go. MIFF for temporary intermediates, and MPC for extremely temporary saves.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply