C: adding text to images
Chris F.A. Johnson
chris-E7bvbYbpR6jSUeElwK9/Pw at public.gmane.org
Thu Dec 23 00:02:08 UTC 2010
On Wed, 22 Dec 2010, Giles Orr wrote:
> A friend of mine recently sent me the following question. I hadn't
> any idea, and got his approval to post here. Can anyone assist?
>
> Question:
>
> Background: I'm looking at satellite data. I wrote a program in C that
> does the following: Slurp up raster data in HDF format, feed the data
> to a program that runs something called iterated conditional modes,
> then writes out the raster data in TIFF.
>
> Problem: How do I make a caption with a legend and some text in it?
> I really don't want to do this pixel-by-pixel in the raster data. I was
> hoping for an easy C function like:
>
> add_text (x_loc, y_loc, size, text_string);
>
> ....that would then make the caption in the TIFF.
>
> I have looked around, and will continue to do so, but haven't found
> anything I like yet. I know Gimp can do this, but I don't want to use
> the GUI: I'd like to use this in my C program.
>
> Any suggestions?
Use ImageMagick. For example, this puts a white circle with a number
in it:
convert -fill white -stroke black -draw "circle 30,30 17,17" \
-font Helvetica-Bold -pointsize 18 -fill black \
-draw 'text 20,37 "12"' in.jpg out.jpg
--
Chris F.A. Johnson, <http://cfajohnson.com>
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list