How to properly change color of postscript text?

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
joew
Posts: 42
Joined: 2012-08-23T01:19:56-07:00
Authentication code: 67789

How to properly change color of postscript text?

Post by joew »

Hello,

I have generated some postscript text with latex, that I want to overlay onto photos. But I have a hard time to change the color of this text. The closest I could get is:

Code: Select all

convert -channel RGBA -density 600 -gravity center \( my-text.ps -trim +repage \) -background none -fill gold -opaque black -filter lanczos -resize 300%x300% out.png
But this leaves some black pixels at the border of the text. I guess this is because of the subpixels.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to properly change color of postscript text?

Post by anthony »

If the text is white on black (negate the text is it isn't) then use -background {color} -alpha shape
The image is now colored text on transparency. You can now overlay that on your image.
See IM Examples, Masking, Alpha Shape
http://www.imagemagick.org/Usage/masking/#alpha_shape

Note you can improve the look of the postscript to raster image conversion using -density to 'super-sample' the vector image.
See Text Handling, Postscript
http://www.imagemagick.org/Usage/text/#postscript
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply