result png file size after montage compared to gimp

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
dafi

result png file size after montage compared to gimp

Post by dafi »

I use montage to produce one finale png with four images.
All works fine but the final file size is ever bigger that the same saved with gimp.

How can I have size more similar to gimp?

Actually my images are RGB with Alpha channel, the command line I use is shown below:

Code: Select all

montage -strip -quality 100 \
        -background none \
         -geometry +0+0 \
         image_1.png image_2.png image_3.png image_4.png \
         result.png
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: result png file size after montage compared to gimp

Post by anthony »

PNG will store images with a lot of detail. So of course the result is bigger.

You can try using a different -quality setting for PNG (see IM examples PNG, quaility)
or better still try using "OptiPNG" to compress you image better.

If exact color and no transparency is involve you can try saving to PNG8:image.png to get a color reduced version. Or you can use another PNG tool "pngnq" to do the same thing in a non-IM way, but attempts to preserve semi-transparency (which the IM PNG8 coder can not do.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dafi

Re: result png file size after montage compared to gimp

Post by dafi »

Thank you for your hints, OptiPNG produces file size smaller than ImageMagicK and very closer to GIMP.

I love ImageMagicK and appreciate very much if it can have same OptionPNG capabilities.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: result png file size after montage compared to gimp

Post by anthony »

That would be nice. and you can actually set up a 'optpng:' output delegate to get IM to call that program itself. (That would actually be a nice delegate example too if someone would care to figure it out.)

however the coders within IM are limited by the fact that IM is itself a general image processor. while optipng is a specialized processor so can spend more time and effort on just one part.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: result png file size after montage compared to gimp

Post by magick »

Try this:
  • convert logo: logo.pnm
    convert logo.pnm png8:logo.png
    ls -l logo.png
    -rw------- 1 cristy cristy 36917 2007-12-03 22:19 logo.png
    optipng -o7 logo.pnm
    ls -l logo.png
    -rw------- 1 cristy cristy 35384 2007-12-03 22:22 logo.png
The resulting images are fairly close in size.
dafi

Re: result png file size after montage compared to gimp

Post by dafi »

magick wrote: optipng -o7 logo.pnm
ls -l logo.png
-rw------- 1 cristy cristy 35384 2007-12-03 22:22 logo.png[/list]

The resulting images are fairly close in size.
This is what I want, my images after "-o7" cure are 38% smaller :D

Thank you
Post Reply