Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The decoding is more different than I thought:

use warnings; use strict; use GD::Simple; use Imager; $\="\n"; my @txt; $txt[0]=" GD::Simple <=> Imager"; my ($x1,$x2,$y)=(1375,1395,29); print "Line $y: Pixel $x1->$x2 "; my $png = GD::Image->newFromPng('test.png'); my ($width, $height) = $png->getBounds; print "GD::Simple Image dimensions: height = $height, width = $width"; for my $x ( $x1 .. $x2 ) { my @c=$png->rgb($png->getPixel($x,$y)); push (@txt,sprintf("%4d: [%3d,%3d,%3d]",$x,@c)); } my $i = Imager-> new; $i->read(file => 'test.png') or die "Cannot read: ", $i->errstr; $width = $i->getwidth(); $height = $i->getheight(); print "Imager Image dimensions: height = $height, width = $width\n +"; for my $x ( $x1 .. $x2 ) { my $color = $i->getpixel( x => $x, y => $y ); my ( $r, $g, $b,$a ) = $color->rgba(); $txt[$x-$x1+1].=sprintf(" <=> %4d: [%3d,%3d,%3d]",$x,$r,$g,$b); } print $_ foreach @txt;
The output for my example is:
Line 29: Pixel 1375->1395 GD::Simple Image dimensions: height = 2560, width = 1600 Imager Image dimensions: height = 2560, width = 1600 GD::Simple <=> Imager 1375: [ 4, 2, 4] <=> 1375: [ 1, 1, 1] 1376: [ 4, 2, 4] <=> 1376: [ 1, 1, 1] 1377: [ 4, 2, 4] <=> 1377: [ 1, 1, 1] 1378: [ 4, 2, 4] <=> 1378: [ 1, 1, 1] 1379: [ 12, 13, 12] <=> 1379: [ 11, 11, 11] 1380: [ 28, 28, 28] <=> 1380: [ 31, 31, 31] 1381: [ 68, 68, 68] <=> 1381: [ 61, 61, 61] 1382: [100,100,100] <=> 1382: [100,100,100] 1383: [100,100,100] <=> 1383: [102,102,102] 1384: [ 68, 68, 68] <=> 1384: [ 68, 68, 68] 1385: [ 52, 52, 52] <=> 1385: [ 48, 48, 48] 1386: [ 36, 34, 36] <=> 1386: [ 40, 40, 40] 1387: [ 36, 34, 36] <=> 1387: [ 33, 33, 33] 1388: [ 20, 26, 28] <=> 1388: [ 26, 26, 26] 1389: [ 20, 20, 20] <=> 1389: [ 20, 20, 20] 1390: [ 12, 13, 12] <=> 1390: [ 14, 14, 14] 1391: [ 4, 10, 12] <=> 1391: [ 9, 9, 9] 1392: [ 4, 6, 4] <=> 1392: [ 6, 6, 6] 1393: [ 4, 2, 4] <=> 1393: [ 4, 4, 4] 1394: [ 4, 2, 4] <=> 1394: [ 2, 2, 2] 1395: [ 4, 2, 4] <=> 1395: [ 1, 1, 1]


In reply to Re^3: working with png data by Anonymous Monk
in thread working with png data by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2019-11-20 04:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Strict and warnings: which comes first?



      Results (96 votes). Check out past polls.

      Notices?