-crop command quality loss

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
Pinch
Posts: 2
Joined: 2013-09-26T03:08:59-07:00
Authentication code: 6789

-crop command quality loss

Post by Pinch »

Hey,
My use of the -crop command requires an image's quality to be maintained, but -crop seems to lose quality.

For example, "convert input_file -crop input_widthxinput_height+0+0 output_file" (where input_width and input_height are the input_file's width and height)
which effectively does nothing, reduces the quality for all file formats (jpg 1.51MB -> 1.26MB, png even worse).
Is there any way to avoid this compression? Or is it not an issue in later versions? (regardless, I'm unable to update the version on the server, so a workaround is preferable).

Version 6.6.4-0 Q16 Windows 7 64-bit

Thanks for you help.
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: -crop command quality loss

Post by holden »

jpeg is lossy- open>do an operation>save will degrade them. Not a good working format. I'm not sure what IM's default compression is, but you can make it highest quality with -quality 100% http://www.imagemagick.org/Usage/formats/#jpg

I'm curious if the png is actually degraded or if IM just saves it smaller by default. PNG is not lossy (or at least not nearly as much).
Pinch
Posts: 2
Joined: 2013-09-26T03:08:59-07:00
Authentication code: 6789

Re: -crop command quality loss

Post by Pinch »

That clears a lot up - link is pretty helpful, cheers. Looks like jpegtran would do the job - I've used it before, but I'm not sure if using it would be possible on my shared hosting.
Do you know if PHP's GD cropping methods are lossless or lossy?
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: -crop command quality loss

Post by holden »

Pinch wrote:Do you know if PHP's GD cropping methods are lossless or lossy?
Not sure, but in most programs jpeg handling is lossy atm. I've never used that particular method personally.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -crop command quality loss

Post by snibgo »

Png shouldn't be lossy at all. If the image changes, it's probably a bug, so please post an example. The file size may change, depending on the compression method. But this shouldn't change the image at all.
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: -crop command quality loss

Post by glennrp »

Maybe you are losing metadata not quaility. Try "identify -verbose" on the input and output files
to see if that tells you anythng.
Post Reply