Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Image::Magick - Exception 435: unable to open file `Image::Magick::Q16' @ error/Q16.xs/XS_Image__Magick__Q16_Read/13529

by kcott (Archbishop)
on Jun 08, 2023 at 13:08 UTC ( [id://11152695]=note: print w/replies, xml ) Need Help??


in reply to Image::Magick - Exception 435: unable to open file `Image::Magick::Q16' @ error/Q16.xs/XS_Image__Magick__Q16_Read/13529

G'day mldvx4,

As I'm not a user of Image::Magick, I left responses to those with more knowledge; however, I see after two days you still have no resolution, so here's some suggestions.

Image::Magick has minimal documentation and points to "PerlMagick Image API for Perl". That appears to be rather dated ("Copyright © 1999") and has Perl code of a similar vintage. It has various issues such as no I/O exception handling and use of a package variable for a filehandle. It looks like your posted code is based on this.

I'd probably write it more like this:

#!/usr/bin/perl use strict; use warnings; use autodie; # for I/O exception handling use Image::Magick; my $svg_filename = '/path/to/some.svg'; my $image = Image::Magick::->new(); open my $fh, '<', $svg_filename; my $err = $image->Read(file => $fh); if ($err) { print "Error b: $err\n"; exit 1; } close $fh; # moved after any code related to $fh print "OK\n"; exit 0;

You said: "I gave it a try and switched from using a file handle to using just a file name ...". I don't know how you implemented that in code; I've used both a filehandle ($fh) and a filename ($svg_filename).

Do note that is untested code: I don't have Image::Magick installed.

— Ken

  • Comment on Re: Image::Magick - Exception 435: unable to open file `Image::Magick::Q16' @ error/Q16.xs/XS_Image__Magick__Q16_Read/13529
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11152695]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found