Resizing JPG images with Perl?

Discussion in 'Perl Misc' started by Mark, Aug 25, 2004.

  1. Mark

    Mark Guest

    I need to write some Perl code that will resize every JPG
    image in a directory. Can someone here suggest a Perl
    module that can do this, which isn't too difficult to learn
    and which won't give me fits trying to build it on my
    Windows XP system?

    Thanks
    -Mark
    Mark, Aug 25, 2004
    #1
    1. Advertising

  2. Mark

    Tore Aursand Guest

    On Wed, 25 Aug 2004 15:21:05 -0700, Mark wrote:
    > I need to write some Perl code that will resize every JPG image in a
    > directory. Can someone here suggest a Perl module that can do this [...]


    Did you even _try_ to search for a module at CPAN?
    <http://www.cpan.org/>


    --
    Tore Aursand <>
    "Time only seems to matter when it's running out." (Peter Strup)
    Tore Aursand, Aug 25, 2004
    #2
    1. Advertising

  3. "Mark" <> wrote in news:I9GdnfgJ97VSjbDcRVn-
    :

    > I need to write some Perl code that will resize every JPG
    > image in a directory. Can someone here suggest a Perl
    > module that can do this, which isn't too difficult to learn
    > and which won't give me fits trying to build it on my
    > Windows XP system?


    It seems like you can get Image::Magick from

    ppm install http://www.bribes.org/perl/ppm/Image-Magick.ppd

    see also:

    http://www.bribes.org/perl/ppmdir.html#ap

    Sinan
    A. Sinan Unur, Aug 26, 2004
    #3
  4. Mark

    Mark Guest

    "Tore Aursand" <> wrote:
    >
    > Did you even _try_ to search for a module at CPAN?
    > <http://www.cpan.org/>


    Yes. That's always the first place I look.

    I downloaded two different modules, both of which
    failed with compiler errors. That doesn't necessarily
    mean that there is a problem with the modules, BUT
    I typically don't encounter this problem with modules
    I download from CPAN.

    -Mark
    Mark, Aug 26, 2004
    #4
  5. Mark

    Tore Aursand Guest

    On Wed, 25 Aug 2004 18:03:39 -0700, Mark wrote:
    >> Did you even _try_ to search for a module at CPAN?
    >> <http://www.cpan.org/>


    > Yes. That's always the first place I look.


    You should have said so. You also should have said which modules you've
    downloaded and why they didn't work for you (or didn't fit your needs).

    I only use Perl under Linux, but I remember there was some sort of "this
    works on the following platforms"-tests somewhere? I think it was at
    CPAN, but my memory might fool me.


    --
    Tore Aursand <>
    "The most likely way for the world to be destroyed, most experts agree,
    is by accident. That's where we come in; we're computer professionals.
    We cause accidents." (Nathaniel Borenstein)
    Tore Aursand, Aug 26, 2004
    #5
  6. Mark

    Mark Guest

    "Mark" <> wrote:
    > I downloaded two different modules, both of which
    > failed with compiler errors.


    For example, I just downloaded PerlMagick and several ImageMagick modules,
    and I am attempting to build PerlMagick using Microsoft C++.
    Once again, it fails (compiler output below.) Any suggestions?
    Is there a freeware C/C++ compiler that I could try that would
    build this project successfully?

    The environment variables for my compiler installation all use
    short filenames, so that doesn't appear to be the problem.

    I also tried the "Digital Mars" compiler, and it choked on one of the
    compiler command-line switches.

    Help!

    Thanks
    -Mark


    C:\temp\PerlMagick-6.02>nmake

    Microsoft (R) Program Maintenance Utility Version 1.50
    Copyright (c) Microsoft Corp 1988-94. All rights reserved.









    cl -c -I../ -I.. -I/usr/include/freetype2 -I/usr/X11R6/include -I/usr/X11R6
    /include/X11 -I/
    usr/include/libxml2 -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE
    -DNO_STRICT -DHAVE_DES_
    FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PER
    LIO -DPERL_MSVCRT_READFI
    X -g -O2 -Wall -pthread -MD -Zi -DNDEBUG -O1 -DVERSION=\"6.0.2\" -DXS_VE
    RSION=\"6.0.2\" "-IC:\P
    erl\lib\CORE" -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H Magick.c
    Command line warning D4025 : overriding '/O1' with '/O2'
    Command line error D2021 : invalid numeric argument '/Wall'
    NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2'
    Stop.
    Mark, Aug 26, 2004
    #6
  7. Mark

    Mark Guest

    FYI, I'm using (attempting to use) VC6.

    Thanks
    -Mark
    Mark, Aug 26, 2004
    #7
  8. On Wed, 25 Aug 2004 15:21:05 -0700,
    Mark <> wrote:
    > I need to write some Perl code that will resize every JPG
    > image in a directory. Can someone here suggest a Perl
    > module that can do this, which isn't too difficult to learn


    With a little code around it, GD, Imager and Image::Magick all can do
    that (probably in reverse order of preference, depending on what else
    you need to do).

    > and which won't give me fits trying to build it on my
    > Windows XP system?


    That depends on the environment on your Windows XP system. The above
    can all be compiled and built under Cygwin on XP, although I'd look
    for precompiled modules first. If you're not using Cygwin, give up,
    and just get ActiveState perl with their pre-compiled modules.

    Why are you insisting on compiling them yourself?

    Martien
    --
    |
    Martien Verbruggen | We are born naked, wet and hungry. Then
    Trading Post Australia | things get worse.
    |
    Martien Verbruggen, Aug 26, 2004
    #8
  9. Mark

    Chris Cole Guest

    On Wed, 25 Aug 2004 19:52:01 -0700, Mark wrote:

    > "Mark" <> wrote:
    >> I downloaded two different modules, both of which failed with compiler
    >> errors.

    >
    > For example, I just downloaded PerlMagick and several ImageMagick
    > modules, and I am attempting to build PerlMagick using Microsoft C++.
    > Once again, it fails (compiler output below.) Any suggestions? Is there
    > a freeware C/C++ compiler that I could try that would build this project
    > successfully?

    [snip]

    gnu gcc is the default C compiler which most 'freeware' software is
    written for. However, imagemagick is available for windows precompiled and
    should work with the Image::magick module.

    http://www.imagemagick.org/www/download.html

    I use all it the time for shrinking jpegs, but on a linux platform so
    YMMV.
    HTH
    Chris.
    Chris Cole, Aug 26, 2004
    #9
  10. On 26 Aug 2004 09:04:11 -0700
    (Randal L. Schwartz) wrote:
    [..]
    > So, after invoking convert some 200 to 300 times, slowly varying the
    > parameters, and trying new things, and then trying to figure out how
    > to convert that to the Perl bindings, again invoking it some 200
    > times or so (I'm not joking about these numbers, and I wish I was),
    > I've come up with [listing one, below].



    And what about Gimp::* hierarchy ? Have someone in this group
    ever tested it ? (I'm curious about it, maybe I'll have to use
    it one day).
    Patrice Auffret, Aug 27, 2004
    #10
  11. Mark

    Ian Wilson Guest

    Randal L. Schwartz wrote:

    > *** post for FREE via your newsreader at post.newsfeed.com ***
    >
    >
    >>>>>>"Patrice" == Patrice Auffret <> writes:

    >
    >
    > Patrice> And what about Gimp::* hierarchy ? Have someone in this group
    > Patrice> ever tested it ? (I'm curious about it, maybe I'll have to use
    > Patrice> it one day).
    >
    > I've had all of like an hour with the Gimp on my screen. With the
    > Gimp being fairly underdocumented, always in motion, and still lagging
    > about 4 years behind Photoshop, there's no reason for me to not use
    > "the real thing".
    >


    Blimey, there's a Photoshop::* module?

    ;-)

    --
    Ian
    Just arranging Perl hopelessly.
    Ian Wilson, Aug 27, 2004
    #11
  12. Mark

    Mark Guest

    "Chris Cole" <> wrote:
    > gnu gcc is the default C compiler which most 'freeware' software is
    > written for. However, imagemagick is available for windows precompiled and
    > should work with the Image::magick module.
    >
    > http://www.imagemagick.org/www/download.html
    >


    Thanks! The binary installed fine, and I'm able to create the thumbnails
    that I need from a command window, so no need to automate anything
    with Perl. :-|

    -Mark
    Mark, Aug 28, 2004
    #12
  13. On Fri, 27 Aug 2004 15:14:42 +0200,
    Patrice Auffret <> wrote:
    > On 26 Aug 2004 09:04:11 -0700
    > (Randal L. Schwartz) wrote:
    > [..]
    >> So, after invoking convert some 200 to 300 times, slowly varying the
    >> parameters, and trying new things, and then trying to figure out how
    >> to convert that to the Perl bindings, again invoking it some 200
    >> times or so (I'm not joking about these numbers, and I wish I was),
    >> I've come up with [listing one, below].

    >
    >
    > And what about Gimp::* hierarchy ? Have someone in this group
    > ever tested it ? (I'm curious about it, maybe I'll have to use
    > it one day).


    The last time I looked at it is well over 18 months ago. While the
    GIMP is a good product as a user interface, the bindings into its API
    left a lot to wish for, most importantly good documentation. I also
    had some trouble with the stability when I made mistakes in my code
    (i.e. segfaults and other sorts of low level crashes), which I don't
    believe should be something a Perl API allows. Also, much of the API
    consists of allowing automation of manual GUI tasks, rather than
    providing a workable interface to automate tasks in general. I didn't
    find it to be much faster than other libraries on general tasks
    either.

    It may very well be that there is better documentation now, and that
    the interface is more Perlish and robust, but when I looked at it,
    back then, it certainly wasn't very accessible, and not something I;d
    recommend to people who don't already intimately know the GIMP.

    Martien
    --
    |
    Martien Verbruggen |
    Trading Post Australia | Can't say that it is, 'cause it ain't.
    |
    Martien Verbruggen, Aug 30, 2004
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roland
    Replies:
    0
    Views:
    1,042
    Roland
    May 12, 2004
  2. Matthias
    Replies:
    5
    Views:
    414
    Whitecrest
    Jun 1, 2004
  3. Yannick

    ASP changes Big JPG -> Small JPG

    Yannick, Feb 2, 2004, in forum: ASP General
    Replies:
    6
    Views:
    147
    Tim Williams
    Feb 3, 2004
  4. Vilmar Brazão de Oliveira
    Replies:
    14
    Views:
    328
    Aaron Bertrand [MVP]
    Mar 5, 2004
  5. Replies:
    3
    Views:
    250
    Andy Dingley
    Sep 27, 2006
Loading...

Share This Page