Unix Programming - Help on writing a text to gif converter

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > April 2004 > Help on writing a text to gif converter





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Help on writing a text to gif converter
Andrew Falanga

2004-04-21, 12:34 pm

I've run in to a brick wall, so to speak, with finding a portable way to
make gif files from plain text. I need something portable, either a C
program or some sort of script.

I've spent considerable time searching on the Internet for a text to gif
converter. I found 2 such PERL scripts. One I'm still trying to figure
out, and the other was primarily gears for converting specially formated
mathematical equations formated in LaTeX.

Because of the issues I've been having, I'm considering writing my own
utility and was hoping that someone here might have used some OpenSource
gif libraries for me to draw on. Ideally, I'd like a C program that I
can compile on the respective platforms. (At this point, HP-UX and linux).

Are there any libs out there? Perhaps some already installed on RedHat?
I don't care, I'm just frustrated with what I've found on the next
thus far.

---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled. I do not wish my account at HP to
become a spam haven.
Jem Berkes

2004-04-21, 1:36 pm

> I've run in to a brick wall, so to speak, with finding a portable way
> to make gif files from plain text. I need something portable, either
> a C program or some sort of script.


You sure you want to make GIF files? Are you ready to pay your licensing to
Unisys?

Scrap GIF and make PNG files instead. You can use libpng:
http://www.libpng.org/pub/png/libpng.html

--
Jem Berkes
http://www.sysdesign.ca/
Jens.Toerring@physik.fu-berlin.de

2004-04-21, 2:35 pm

Andrew Falanga <falandrew@hp.com> wrote:
> I've run in to a brick wall, so to speak, with finding a portable way to
> make gif files from plain text. I need something portable, either a C
> program or some sort of script.


> I've spent considerable time searching on the Internet for a text to gif
> converter. I found 2 such PERL scripts. One I'm still trying to figure
> out, and the other was primarily gears for converting specially formated
> mathematical equations formated in LaTeX.


> Because of the issues I've been having, I'm considering writing my own
> utility and was hoping that someone here might have used some OpenSource
> gif libraries for me to draw on. Ideally, I'd like a C program that I
> can compile on the respective platforms. (At this point, HP-UX and linux).


> Are there any libs out there? Perhaps some already installed on RedHat?
> I don't care, I'm just frustrated with what I've found on the next
> thus far.


Unfortunately your specifications are much too unspecific. Text is
just a bunch of characters without any specific formatting, without
any information about what font to use etc. If you're not looking for
something fancy perhaps the simplest solution would be (if it's only
a short text, maybe fitting on a single line) to convert the text to
simple Postscript and then use one of the available converters (i.e.
ImageMagick). Something like that could possibly done with a rather
short script (mostly consisting of the text for the Postscript wrapper).

Regards, Jens
--
\ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Andrew Falanga

2004-04-21, 3:35 pm

>
> Unfortunately your specifications are much too unspecific. Text is
> just a bunch of characters without any specific formatting, without
> any information about what font to use etc. If you're not looking for
> something fancy perhaps the simplest solution would be (if it's only
> a short text, maybe fitting on a single line) to convert the text to
> simple Postscript and then use one of the available converters (i.e.
> ImageMagick). Something like that could possibly done with a rather
> short script (mostly consisting of the text for the Postscript wrapper).
>
> Regards, Jens


This approach sounds good. Where can I learn about creating postscript
files? (Litterally, I've never created a postscript file.)

--

---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled. I do not wish my account at HP to
become a spam haven.
Victor Wagner

2004-04-21, 3:35 pm

Andrew Falanga <falandrew@hp.com> wrote:
:>
:> Unfortunately your specifications are much too unspecific. Text is
:> just a bunch of characters without any specific formatting, without
:> any information about what font to use etc. If you're not looking for
:> something fancy perhaps the simplest solution would be (if it's only
:> a short text, maybe fitting on a single line) to convert the text to
:> simple Postscript and then use one of the available converters (i.e.
:> ImageMagick). Something like that could possibly done with a rather
:> short script (mostly consisting of the text for the Postscript wrapper).
:>
:> Regards, Jens

: This approach sounds good. Where can I learn about creating postscript
: files? (Litterally, I've never created a postscript file.)


Postscript is just yet another programming language. There is book
"Thinking in Postscript", available on the Net in the PDF format. It
should be enough.

I have an example of such approach on http://45.free.net/cgi-bin/mkgif
(not sure that all fonts I put in the menu of this script some years ago
still available on my system).

But if you don't need fancy formatting, you don't need
postscript.

There is netpbm suite of utilities, which contain ascii2pgm program,

Also take look to the gd graphics library.

--
MS-DOS, you can't live with it, you can live without it.
-- from Lars Wirzenius' .sig
Stefaan A Eeckels

2004-04-22, 6:35 am

On Wed, 21 Apr 2004 12:46:20 -0600
Andrew Falanga <falandrew@hp.com> wrote:

> This approach sounds good. Where can I learn about creating postscript
> files? (Litterally, I've never created a postscript file.)
>

For the purpose of converting a text file (or text messages) into
GIF or another graphics format, you can use a2ps
<http://www.inf.enst.fr/~demaille/a2ps/> to convert your text file
to PostScript, and then Aysushi Saito's ps2png.pl
<http://www.hpl.hp.com/personal/Yasushi_Saito/pstopng.pl>
(yep, a colleague) to turn it into a PNG image.
Converting to GIF is equally easy, if you _must_ use GIF
(google for pstogif).

Take care,

--
Stefaan
--
"What is stated clearly conceives easily." -- Inspired sales droid
Glen

2004-04-22, 11:36 am

Hi Andrew,

Have you tried the SNG program?

-- SNIP
SNG (Scriptable Network Graphics) is a minilanguage designed
specifically to represent the entire contents of a PNG (Portable
Network Graphics) file in an editable form. Thus, SNGs representing
elaborate graphics images and ancillary chunk data can be readily
generated or modified using only text tools.

SNG is implemented by a compiler/decompiler called sng that losslessly
translates between SNG and PNG.
-- SNIP

You might also look at any2png and gif2png.

See the following web sites for info about the programs mentioned
above. Gluck.
http://www.libpng.org/pub/png/
http://sng.sourceforge.net/

Cheers,
Glen.

Andrew Falanga <falandrew@hp.com> wrote in message news:<4086a3a4$1@usenet01.boi.hp.com>...
> I've run in to a brick wall, so to speak, with finding a portable way to
> make gif files from plain text. I need something portable, either a C
> program or some sort of script.
>
> I've spent considerable time searching on the Internet for a text to gif
> converter. I found 2 such PERL scripts. One I'm still trying to figure
> out, and the other was primarily gears for converting specially formated
> mathematical equations formated in LaTeX.
>
> Because of the issues I've been having, I'm considering writing my own
> utility and was hoping that someone here might have used some OpenSource
> gif libraries for me to draw on. Ideally, I'd like a C program that I
> can compile on the respective platforms. (At this point, HP-UX and linux).
>
> Are there any libs out there? Perhaps some already installed on RedHat?
> I don't care, I'm just frustrated with what I've found on the next
> thus far.
>
> ---------------------------------------------
> Andrew R. Falanga (a non-HP employee)
> Hewlett-Packard Company
> 11311 Chinden Blvd.
> Boise, Idaho
> ---------------------------------------------
> Please note: The e-mail address is purposely
> mangled. I do not wish my account at HP to
> become a spam haven.

William Park

2004-04-22, 5:34 pm

Andrew Falanga <falandrew@hp.com> wrote:
> I've run in to a brick wall, so to speak, with finding a portable way to
> make gif files from plain text. I need something portable, either a C
> program or some sort of script.
>
> I've spent considerable time searching on the Internet for a text to gif
> converter. I found 2 such PERL scripts. One I'm still trying to figure
> out, and the other was primarily gears for converting specially formated
> mathematical equations formated in LaTeX.


If it can put math in an image, then it can also put text. Main thing
is that there are different font styles and font sizes to choose from.
This is true even on console terminal.

man ImageMagick
man convert

--
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Linux solution/training/migration, Thin-client
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com