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

Hi,
Can perl convert .ppm image file to .jpeg image file.
How can the conversion be done using the perl script .
Are there any modules for it . Thankyou !
  • Comment on perl script to convert .ppm image to .jpeg image

Replies are listed 'Best First'.
Re: perl script to convert .ppm image to .jpeg image
by jasonk (Parson) on Dec 03, 2003 at 14:51 UTC

    ImageMagick has a convert tool that can convert just about any format to any other format. There is also a perl module to interface with it.


    We're not surrounded, we're in a target-rich environment!
      If ImageMagick is installed on Linux or Windows, try this...

      my $command = 'convert name.ppm name.jpg';
      system($command);
      Hi,<br< I am getting an error when I try to install the module.
      make error
        You can't be serious.
        "make error"? is that it?

        rdfield

        update: Have you read the Tutorials? I recommend that you start at the top and work you way down.

Re: perl script to convert .ppm image to .jpeg image
by Roy Johnson (Monsignor) on Dec 03, 2003 at 15:45 UTC
    The Independent JPEG Group's free implementation of JPEG (which is required for JPEG support in most any package, including ImageMagick) includes a program named "cjpeg" for doing exactly this. "djpeg" does the reverse.

    The PerlMonk tr/// Advocate