Operating System - HP-UX
1833247 Members
2970 Online
110051 Solutions
New Discussion

How to convert a text string in a GIF file

 
SOLVED
Go to solution
Enrico Venturi
Super Advisor

How to convert a text string in a GIF file

Hello colleagues,
how can I produce a GIF file containing the image of a text string?

thank you
Enrico
5 REPLIES 5
Steve Steel
Honored Contributor
Solution

Re: How to convert a text string in a GIF file

Hi

try getting ImageMagick from internet

great software


or xv from the hp-ux public domain


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Enrico Venturi
Super Advisor

Re: How to convert a text string in a GIF file

1. I got the ImageMagick software: I didn't find any command to produce a GIF file containing the aimed text string; it seems there's a bug because some libraries aren't found.

2. xv allows to produce an image by an editor ... I need something like
$ text2gif "mytext" out.gif

thank you
enrico
T G Manikandan
Honored Contributor

Re: How to convert a text string in a GIF file

Hello

you can use Macromedia Dreamweaver.

check this link out

http://www.macromedia.com/software/dreamweaver/productinfo/extend/insta.html
Gregory Fruth
Esteemed Contributor

Re: How to convert a text string in a GIF file

The GD package will let you generate simple PNG
and JPEG images programmatically.

http://www.boutell.com/gd/

You can call GD from Perl, C, and some other
languages. Then you can use NetPBM or
whatnot to convert to GIF (if you absolutely
must).

The C code would look something like:

#include "gd.h"
#include "gdfontl.h"
...
gdImgPtr img = gdImageCreate(100, 100);
int black = gdImageColorAllocate(img, 0, 0, 0);
gdImageString(img, gdFontLarge, 10, 10, "foo", black);
gdImagePng(img, stdout);

The text support in GD is good enough for simple
uses. For fancy text, you could use the scripting
facility in the GIMP (http://www.gimp.org).

HTH
Gregory Fruth
Esteemed Contributor

Re: How to convert a text string in a GIF file

Okay, here's a working GD example...

Compile with "cc -Ae -I/opt/local/include myprog.c -L/opt/local/lib
-lgd -lpng -lz -lm" (replace /opt/local/* with the appropriate
paths). To run it: "a.out | xv -"

#include "gd.h"
#include "gdfontl.h"

int main() {
gdImagePtr img = gdImageCreate(100, 100);
int white = gdImageColorAllocate(img, 255, 255, 255);
int black = gdImageColorAllocate(img, 0, 0, 0);
gdImageString(img, gdFontLarge, 10, 10,
(unsigned char *) "foo", black);
gdImagePng(img, stdout);
return(0);
}