Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

barbie (2653)

barbie
  reversethis-{ku. ... m} {ta} {eibrab}
http://barbie.missbarbell.co.uk/

Leader of Birmingham.pm [pm.org] and a CPAN author [cpan.org]. Co-organised YAPC::Europe in 2006 and the 2009 QA Hackathon, responsible for the YAPC Conference Surveys [yapc-surveys.org] and the QA Hackathon [qa-hackathon.org] websites. Also the current caretaker for the CPAN Testers websites and data stores.

If you really want to find out more, buy me a Guinness ;)

Links:
Memoirs of a Roadie [missbarbell.co.uk]
[pm.org]
CPAN Testers Reports [cpantesters.org]
YAPC Conference Surveys [yapc-surveys.org]
QA Hackathon [qa-hackathon.org]

Journal of barbie (2653)

Thursday February 12, 2004
09:08 AM

ImageMagick on Win32

[ #17374 ]
Yesterday I scrubbed my previous version of ImageMagick and reinstalled, so that I could use it with Perl 5.6.1 (on Win 2000 Pro). The installation itself went fine, and so did the PPM install Perl::Magick. However, the problem now arises that the two don't appear to speak to each other too well.

I have a little script that simply reads a JPG file and rotates through 90°. The Read() function reports Warning 330: no magic configuration file found (magic.mgk). There are several installation guides and FAQs online regarding various Win32 quirks, and having tried them all I still get the error. Just to satisfy my own curiosity, I tried one of the demo scripts, which creates a GIF image, and low and behold it works. I can only assume my error is in relation to the JPG image.

The sad thing is, in my search for a cure I've trawlled the users and developers lists and came across several people with the same or similar problems. Oddly not one of them ever got an answer. I can only assume from that, that either it must be a bug and no-one has figured out a solution, or those that do know a solution can't be bothered to respond. Either way it's a bit disappointing.

I've now given up the ghost and in barely 5mins have rewritten the code to use GD. It works like a charm :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Are you using it for digital photos & auto rotation?? If so can you post the script, it will save me from writing the same thing myself. -- John Cavanaugh
    • This was my simple test script for GD. Ultimately it'll be included in a CGI upload facility I wanted to use, but it gives an idea of what I was after:

      #!/usr/bin/perl -w use strict; use GD; my $start = 'D_00a.jpg'; my $image = 'D_00b.jpg'; my $thumb = 'D_00b.png'; my $rotate = 90; # read in current image my $i = GD::Image->newFromJpeg($start) ; print("read image error: [$start]\n") unless $i; return 1 unless $i; # rotate clockwise by $angle degrees my $p = $i->copyRotate90() if($rota

    • Ignore that last one, I've just discovered that the submit and preview buttons for comments are in a different order to that of journal entries. Bugger!

      Here's the real script:

      #!/usr/bin/perl -w
      use strict;

      use GD;

          my $start = 'D_00a.jpg';
          my $image = 'D_00b.jpg';
          my $thumb = 'D_00b.png';

          my $rotate = 90;

          # read in current image
          my $i = GD::Image->newFromJpeg($start) ;
          print("read image error: [$start]\n")

  • The problem is that any version of PerlMagick only works with the same version of ImageMagick COMPILED WITH THE SAME SETTINGS MEANING THE FUCKING VERSION ON CPAN IS JUST ABOUT USELESS BUT THE FUCK DOES THE AUTHOR CARE, SEEMS NOT!

    Sorry, just got a bit upset. Good call using GD, if you just want to rotate however use jpegtran which does lossless rotation of jpegs.

    --
    sky
    • Hmmm. I take it you're not a fan then ;p

      Thanks for the tip about jpegtran, although I was also after thumbnailing to PNG too. I have a particular image upload feature within my pet project that needs updating. I wanted to have something that will work on Windows and Linux, so it seems GD is the winner.

  • Do you have a c:\ImageMagick directory containing delegates.mgk and magic.mgk? That seems to be what it's looking for, and I vaguely remember having to create the directory manually when I installed ImageMagick on Windows a couple of years ago.
    • Yep, did all that. Also put DLLs in directories everywhere, change the MAGICK_HOME and PATH environment variables, and rebooted (several times) all to no avail. The fact that many people have posted to the imagemagick lists and had no response, doesn't bode well that there is a simple solution :(