http://qs1969.pair.com?node_id=328761

fraktalisman has asked for the wisdom of the Perl Monks concerning the following question:

I need to convert GIF images into JPEG format. Unfortunately, the server has neither GD nor Image::Magick installed. Is there any way to do this without the admin installing something, just with a perl script? I know technically that it must be possible, so maybe someone has done this already?

Replies are listed 'Best First'.
Re: GIF to JPEG without GD/Image::Magick
by BazB (Priest) on Feb 13, 2004 at 10:48 UTC

    You can install modules yourself, without root/admin access.
    With modules such as GD (not sure about Image::Magick), you may also need to install the libraries too.

    See A Guide to Installing Modules, paying specific attention to the "I don't have permission to install a module on the system!" section.

    With this in mind, I'd look at installing and using Image::Magick - it works a treat.


    If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
    That way everyone learns.

Re: GIF to JPEG without GD/Image::Magick
by l3nz (Friar) on Feb 13, 2004 at 13:27 UTC
    Though theoretically feasible, a GIF to JPG converter written entirely in Perl would be too slow and likely suck up too much memory at runtime to be of any usefulness. Such computationally intensive tasks are better left to the likes of C.

    You should look on you target machine to determine whether there's anything you need installed and/or do the conversion in some other way. Maybe you can download all the files to some other machine, convert them and then upload the converted files; this is the kind of task that's easy to automatize in Perl.

Re: GIF to JPEG without GD/Image::Magick
by Roy Johnson (Monsignor) on Feb 13, 2004 at 15:50 UTC
    The standard distribution of the Independent JPEG Group's software (which is where you get the standard, free JPEG library) includes a program called cjpeg which will convert to JPEG from GIF (as well as from Targa, PPM, and RLE). djpeg converts the other way.

    The PerlMonk tr/// Advocate
      cjpeg which will convert to JPEG from GIF
      Unfortunately it doesn't seem to anymore, the manpage says:
      The currently supported input file formats are: PPM (PBMPLUS color format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit format). (RLE is supported only if the URT library is available.)
      Update: Version 6 of 1995 still seems to be able to do it.
      To be a bit more precise about my task, I am working on a component of a CMS/shop system that should be able to run on servers of various web hosters. To get administrative rights would be one thing, but too expensive for the average user of our cms.
      It seems most hosters use image libraries without GIF support because of licensing issues?
Re: GIF to JPEG without GD/Image::Magick
by nite_man (Deacon) on Feb 13, 2004 at 10:54 UTC

    For convert images from one format to other you can use utility convert:

    $ convert test.gif test.jpeg

    ~ Schiller

      isn't convert a tool for Image Magick?

      chady@nemo ~ $ convert Version: @(#)ImageMagick 5.4.7 07/01/02 Q:16 http://www.imagemagick.or +g Copyright: Copyright (C) 2002 ImageMagick Studio LLC <snip>

      He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

      Chady | http://chady.net/

        Yes, you are right. convert is utility from ImageMagick. If this package is installed on your web server, just use convert (no need to install any Perl modules) or install GD or Image::Magick in your home directory (no need root privelege).

        Anyway, I think,some graphical tool should be installed on the server (I mean native libraries) to convert, change or produce some graphical documents.

        ~ Schiller