How to make 'label:' in RGB .png

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
mich
Posts: 3
Joined: 2015-11-06T20:44:03-07:00
Authentication code: 1151

How to make 'label:' in RGB .png

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
mich
Posts: 3
Joined: 2015-11-06T20:44:03-07:00
Authentication code: 1151

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

Post 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 ...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
mich
Posts: 3
Joined: 2015-11-06T20:44:03-07:00
Authentication code: 1151

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

Post 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.
Post Reply