Page 1 of 1

convert -flop image.jpg image.jpg

Posted: 2008-03-10T11:57:06-07:00
by cmancre
Hi everyone. I'm new to imagemagick and so far so good... I'm playing around with what could be done by command line and I notice this:
Running the following command convert -flop image.jpg image.jpg , i.e, flopping an image to it self. This actions results in a loss of quality. The floped image starts to look a bit pixelized and stripes.
Is there anything I can do?

Thanks

Re: convert -flop image.jpg image.jpg

Posted: 2008-03-10T15:33:31-07:00
by rmagick
Are you running this command more than once? Keep in mind that JPEG is a lossy format. Each time you modify a JPEG image the image is re-compressed with a resulting loss of quality. After enough recompressions you end up with a bad-looking image. If you need to make several changes to a JPEG image, save the intermediate versions of the image in a non-lossy format such as ImageMagick's MIFF format.

Re: convert -flop image.jpg image.jpg

Posted: 2008-03-10T16:12:17-07:00
by fmw42
put the input image before the -flop and also regarding the loss, save the image in non-jpeg format such as png or use -quality 100

convert image.jpg -flop image1.png

or

convert image.jpg -flop -quality 100 image2.jpg

Re: convert -flop image.jpg image.jpg

Posted: 2008-03-11T03:49:19-07:00
by cmancre
That's because default quality is 80 or something like that.

Thanks a lot

Re: convert -flop image.jpg image.jpg

Posted: 2008-03-15T05:01:06-07:00
by anthony
Note that -quality 100 will only slow the loss in a normal JPEG image file format. It will only produce a lossless quality for JPEG2000 image file format.

However cmancre is right in that IM has no real way of determining the original quality (by default) of a input JPEG image. Though it does have a method of making a rough guess at the quality.

Best Ideal is to only use JPEG for the final display image, but keep images in some other loss-less format for later modifications. Better still always start from the source image rather than modify an already modified image.

See IM Examples, Common File Formats, JPEG for more info