Home > Archive > PERL Miscellaneous > August 2004 > Resizing JPG images with Perl?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Resizing JPG images with Perl?
|
|
|
| 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
| |
| Tore Aursand 2004-08-25, 8:56 pm |
| 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 <tore@aursand.no>
"Time only seems to matter when it's running out." (Peter Strup)
| |
| A. Sinan Unur 2004-08-25, 8:56 pm |
| "Mark" <nospam@thanksanyway.org> wrote in news:I9GdnfgJ97VSjbDcRVn-
qg@speakeasy.net:
> 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
| |
|
| "Tore Aursand" <tore@aursand.no> 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
| |
| Tore Aursand 2004-08-26, 3:56 am |
| On Wed, 25 Aug 2004 18:03:39 -0700, Mark wrote:
[color=darkred]
> 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 <tore@aursand.no>
"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)
| |
|
| "Mark" <nospam@thanksanyway.org> 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.
| |
|
| FYI, I'm using (attempting to use) VC6.
Thanks
-Mark
| |
| Martien Verbruggen 2004-08-26, 3:56 am |
| On Wed, 25 Aug 2004 15:21:05 -0700,
Mark <nospam@thanksanyway.org> 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.
|
| |
| Chris Cole 2004-08-26, 8:56 am |
| On Wed, 25 Aug 2004 19:52:01 -0700, Mark wrote:
> "Mark" <nospam@thanksanyway.org> wrote:
>
> 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.
| |
| Randal L. Schwartz 2004-08-26, 4:01 pm |
| *** post for FREE via your newsreader at post.newsfeed.com ***
[color=darkred]
Mark> For example, I just downloaded PerlMagick and several ImageMagick modules,
Mark> and I am attempting to build PerlMagick using Microsoft C++.
Mark> Once again, it fails (compiler output below.) Any suggestions?
Oww. See my rant about ImageMagick and PerlMagick at
<http://www.stonehenge.com/merlyn/LinuxMag/col33.html>:
GD's font capabilities never really impressed me, so I turned (with
some great hesitation) to the ImageMagick library, and its
PerlMagick binding. I believe I know where the ``Magick'' part of
the library gets its name: when you finally figure out how to do
what you want, it appears to be ``magick'', since the documentation,
well, is mostly absent.
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].
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
-----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----
| |
| Patrice Auffret 2004-08-27, 3:58 pm |
| On 26 Aug 2004 09:04:11 -0700
merlyn@stonehenge.com (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).
| |
| Randal L. Schwartz 2004-08-27, 3:58 pm |
| *** post for FREE via your newsreader at post.newsfeed.com ***
[color=darkred]
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".
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
-----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----
| |
| Ian Wilson 2004-08-27, 8:56 pm |
| Randal L. Schwartz wrote:
> *** post for FREE via your newsreader at post.newsfeed.com ***
>
>
>
>
> 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.
| |
|
|
"Chris Cole" <ithinkiam@gmail.com> 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
| |
| Martien Verbruggen 2004-08-29, 8:56 pm |
| On Fri, 27 Aug 2004 15:14:42 +0200,
Patrice Auffret <patrice.auffret@intranode.com> wrote:
> On 26 Aug 2004 09:04:11 -0700
> merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> [..]
>
>
> 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.
|
|
|
|
|
|