Crop file larger than orginal because image was changed

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?".
Locked
troyd1
Posts: 73
Joined: 2007-07-29T17:13:19-07:00

Crop file larger than orginal because image was changed

Post by troyd1 »

I have an 8 bit png image that is 1838x1238. I did the following:
convert orig.png -crop 1800x1200+19+19 +repage crop.png

I also did:

convert orig.png -shave 19x19 shave.png

both resulting images are identical I believe, but the orig.png was an 8 bit image, and the new images are a 16 bit images. I believe this is why the files are larger. Please shed some light on this and if I need to/can keep the image at 8 bit, how do I do that. I am running version 6.3.5.q16.

Thanks, Troy

Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Crop file larger than orginal because image was changed

Post by Bonzo »

Resizing a png as a test the 16bit file was 8x larger than the 8bit.

From a previous post try saving as png8:crop.png which should keep the image as 8bit.

troyd1
Posts: 73
Joined: 2007-07-29T17:13:19-07:00

Re: Crop file larger than orginal because image was changed

Post by troyd1 »

Worked like a charm. Thanks!

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Crop file larger than orginal because image was changed

Post by anthony »

WARNING: png8; is equivelent to GIF. It uses a 256 color limited pallette.

If you want 8bit value images and thus a 24 bit image, use png24:
OR add -depth 8 to the command line.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Locked