Resizing JPG images with Perl?

M

Mark

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
 
M

Mark

Tore Aursand said:
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
 
T

Tore Aursand

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.
 
M

Mark

Mark said:
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.
 
M

Martien Verbruggen

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
 
C

Chris Cole

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.
 
P

Patrice Auffret

On 26 Aug 2004 09:04:11 -0700
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).
 
I

Ian Wilson

Randal said:
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?

;-)
 
M

Mark

Chris Cole said:
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
 
M

Martien Verbruggen

On 26 Aug 2004 09:04:11 -0700
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top