Running ActiveState Perl v5.12.4 with Win7Pro on a Gateway SX-2841 (64-bit).
I am trying to understand the Imager package. I started by installing:
>ppm install Imager
This seems to have worked OK. I have printed and read all of the .doc files.
Let me start with the question, "How do I read a PNG iamge?"
I started with some code from the tutorial::
use Imager;
my $image_source = $ARGV[0];
my $image = Imager->new;
$image->read(file=>$image_source)
or die "Cannot load $image: ", $image->errstr;
then, when I try to read the PNG file, I get
>perl readpng.pl d2020.png
Cannot load Imager=HASH(0x10d970):
format 'png' not supported -
formats bmp, ico, pnm, raw, sgi, tga available for reading -
Can't locate Imager/File/PNG.pm at C:\c\Perl\graphics\boxes.pl line
+4.
OK. So maybe I do not have the PNG code?
use Imager;
printf "%s\n", join " ", Imager->read_types;
printf " %s\n", join " ", keys %Imager::formats;
This produces two lists:
sgi bmp ico pnm tga raw
bmp pnm tga ifs raw w32
Somewhere, I read a comment that there's a bit of a trick to loading the code for different formats.
I said to ask for help. I'm doing that now....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.