Page 1 of 1

How to make 'label:' in RGB .png

Posted: 2015-11-06T21:37:53-07:00
by mich
I would like to make simple text label in RGB (or RGBA) .png file.
What I did is:

convert -font Tahoma -pointsize 240 -undercolor black -fill whilte \
label:ABC -colorspace RGB -depth 8 out.png

It works just fine, but got the result in grayscale format.
I tried moving '-colorspace' position before '-font' command or other places, but always getting only grayscale result.
How can I get RGB (or RGBA) result?
I'm using ImageMagick-6.9.2-Q16.
TIA

Re: How to make 'label:' in RGB .png

Posted: 2015-11-06T22:21:57-07:00
by fmw42
You misspelled white. Also you should use -background black rather than -undercolor. You do not need -colorspace, but whenever you do, you should use -colorspace sRGB not -colorspace RGB. The latter is linear and thus will be darker. Try

Code: Select all

convert -font Tahoma -pointsize 240 -background black -fill white label:"ABC" -depth 8 PNG24:result.png
If transparency, use PNG32: rather than PNG24:

See
http://www.imagemagick.org/Usage/text/#label
http://www.imagemagick.org/Usage/formats/#png_formats

Also in the future, please always specify your platform, since there can be syntax differences on Windows and Unix systems. Also best to specify the full IM version via

Code: Select all

convert -version

Re: How to make 'label:' in RGB .png

Posted: 2015-11-07T04:01:26-07:00
by mich
Thanks for your very fast reply, fmw42.
I got exactly what I need following your direction.
Still I'm not sure what I was wrong, but anyway I gonna read more docs as you indicated.
Thank you.

BTW, my platform is WindowsXp/8.1, and the IM '-version' says:
Version: ImageMagick 6.9.2-4 Q16 x86 2015-10-10 ...
Visual C++: 180031101 ...

Re: How to make 'label:' in RGB .png

Posted: 2015-11-07T12:03:38-07:00
by fmw42
Generally, IM will force a grayscale format if the data is grayscale and if the image type supports that. To overcome grayscale in order to output an (s)RGB format, some image types such as TIF will respect -type truecolor or truecoloralpha. PNG requires the use of PNG24: or PNG32:. JPG needs a special define to overcome that issue. See http://www.imagemagick.org/script/formats.php

Re: How to make 'label:' in RGB .png

Posted: 2015-11-07T17:18:07-07:00
by mich
fmw42,
> Generally, IM will force a grayscale format if the data is grayscale and if the image type supports that.
Oh, I understood. It's a very important point that I miffed.
Thanks again.