crop behaviour for convert

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
victorlesk

crop behaviour for convert

Post by victorlesk »

Hi I have an image a.pnm of size 12x12.

I run the crop command

convert -crop 12x12 b.pnm

Which should result in exactly the same image. However, the file size is different, so I can't use unix diff to compare them. Why is the output file different from the input file, and how can I make them the same?

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

Re: crop behaviour for convert

Post by fmw42 »

is your original 8-bits and are you on a Q16 IM? if so you may be converting 8-bit image to 16-bit image.

Also your crop command is not correct (perhaps typo - but you only specify one image)

Try

convert a.pnm -crop 12x12+0+0 +repage a2.pnm

add -depth 8 if you want to keep 8-bits and are on a Q16 IM.

What does

identify -verbose a.pnm

tell you about the input and do the same on your output a2.pnm
Post Reply