Re: Image Converters

lilley ([email protected])
Wed, 14 Dec 1994 16:03:16 +0000 (GMT)


>
> Ralph Graw writes:
> > [This message is converted from WPS-PLUS to ASCII]
> >
> > When dynamically producing pages with <IMG SRC=...> tags, we've run into a
> > need to convert images from various formats (particularly JPEG) into GIF on
> > the fly. A utility callable from a CGI script (Tcl running on Solaris)
> > would be ideal.

This sounds like the textual material is created dynamically but the JPEGs
and GIFs are essentially static. Is that correct?

I would hesitate to call it ideal. The last modify date will always be *now*
which defeats sensible proxy cacheing, and you do the same conversion over
and over for highly-cited images.

At least cache them!

I would have though a better way would be to use find on your server docroot
and for each jpeg, if there is no gif with the same basename or the
corresponding GIF is older, convert it.

Run this in a cron job every day/week/hour depending on how dynamic your
web publishing is.

Also, several browsers either support inline JPEG (Chimera, Netscape) or
have stated that they will do so in the future (Arena) so leaving the
files as JPEGs might be an option.

> > Surely the Unix world already has such and we don't have
> > to code this from scratch? Not sure where we'd get the formats anyway...

Correct

> You can use the JPEG-v5 and NETPBM utilities to do this, but I imagine
> there is probably a faster way. Something like this:
>
> #!/bin/sh
> echo 'Content-Type: image/gif'
> echo
> djpeg [any options] filename | ppmtogif
>
> Unfortunately, this won't give you a content-length, but oh well. :)

Oh, gross ;-)

At least make it check for an existing conversion, if not, convert it and
store it. Then you get a content length and a speed improvement, too.

--
Chris Lilley
+-------------------------------------------------------------------------+
| Technical Author, Manchester and North HPC Training & Education Centre  |
+-------------------------------------------------------------------------+
| Computer Graphics Unit,        |     Email: [email protected]      |
| Manchester Computing Centre,   |     Voice: +44 61 275 6045             |
| Oxford Road,                   |       Fax: +44 61 275 6040             |
| Manchester, UK.  M13 9PL       |      X400: /I=c /S=lilley              |
|                 /O=manchester-computing-centre /PRMD=UK.AC /ADMD= /C=GB/|
|<A HREF="http://info.mcc.ac.uk/CGU/staff/lilley/lilley.html">my page</A> | 
+-------------------------------------------------------------------------+
|This is supposed to be data transfer, not artificial intelligence. M VanH|
+-------------------------------------------------------------------------+