New to Imagemagick

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
GoldenGonaz
Posts: 2
Joined: 2012-07-17T13:59:55-07:00
Authentication code: 15

New to Imagemagick

Post by GoldenGonaz »

Hello all,

I am new to imagemagick and have a question or two. I'd really appreciate if anyone could lend some advice...

I have imagemagick on my server, I do not know if it is Q8 or Q16 - I only heard about these today, as far as i was aware it was just imagemagick.

I am trying to compress some png images so they save as png-8 (not png 24, I want smaller more compressed files). I was advised by someone that I may need to install imagemagick Q8 instead of Q16. Would that be correct advise, would it mean images made as a result of imagemagick Q8 were smaller file size (and less quality)?

Also if I wanted to install imagemagick q8, how would I go about that. I have a FreeBSD server...

Thanks for any help, as I said it's really appreciated as this is really quite lost on me.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: New to Imagemagick

Post by fmw42 »

You do not need to install Q8, the default Q16 will work fine.

You can find out what version of IM by typing

convert -version

and the reply will be something like

Version: ImageMagick 6.7.8-2 2012-07-08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:

To compress your png, do the following:
(this assumes your png has no transparency. if so then if it is 8-bit transparency, converting palette via PNG8: will make the transparency binary)

convert image.png -depth 8 PNG8:result.png

If this does not work, try either

convert image.png -depth 8 -type palette PNG8:result.png
or
convert image.png -depth 8 -type palette result.png

If transparency in your image, then use -type palettematte.

see
http://www.imagemagick.org/script/comma ... .php#depth
http://www.imagemagick.org/Usage/formats/#png
http://www.imagemagick.org/Usage/formats/#png_formats
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: New to Imagemagick

Post by glennrp »

You can just do

Code: Select all

convert in.png png8:out.png
You don't actually need either -type or -depth; the PNG8 sub-format sets those for you.
You might want to strip out unnecessary ancillary PNG chunks, which the "-strip" option will do for you:

Code: Select all

convert in.png -strip png8:out.png
fmw42 is correct, you can use either Q8 or Q16 for this.
GoldenGonaz
Posts: 2
Joined: 2012-07-17T13:59:55-07:00
Authentication code: 15

Re: New to Imagemagick

Post by GoldenGonaz »

Thanks guys, some of this really helped :D
Post Reply