views:

723

answers:

5

I need to add text string to a TIFF image. I am planning to use libTIFF for editing the TIFF image. The plan is to convert text to image using freetype2 and then somehow render the text image on to TIFF. Is this the right approach?

Any pointers on how to convert text to image? I saw the sample code of ft2 - initialising the library, creating face and then setting character sizes. But not sure what to do next? any pointers appreaciated.

+2  A: 

One way could be using ImageMagick. They have tools for image composition and text rendering. (and many more)

Although ImageMagick is primarily used from the command line (especially in web environments) several language interfaces are available, too. Java, C, C++, ...

DR
A: 

You don't tell us which language you need to use, should it be portable or for a given platform, etc.
Using a ready to use existing graphic library, like the (big!) ImageMagick or others like libGD or DevIL might be the easiest way, lot of them have binding for lot of languages.

PhiLho
A: 

language must be C/C++ and target is Windows platform.

A: 

ImgSource is a really nice library for C/C++ on Windows, and it can do this out of the box.

http://www.smalleranimals.com/isource.htm

It's not free, but it's pretty cheap ($59)

Lou Franco
A: 

if youre on windows and in c++ then it's pretty easy to use gdiplus for drawing fonts. you have access to any installed font and you can save the raster out as tiff or jpeg etc as well using the one api.

of course you could also use some combo of freetype and libtiff, but you'll have to build those libs for win32. not that its hard, just more fussing around you may not want to do.