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

Re^4: working with png data

by vr (Curate)
on Sep 11, 2019 at 08:47 UTC ( [id://11106007]=note: print w/replies, xml ) Need Help??


in reply to Re^3: working with png data
in thread working with png data

I could not manage to install PDL yet. Prerequisite 'Module::Compile' is not passing for WIN 10 (report). Only one test is failing.(data1_t). Any idea what I could do here ? Force install ?

I've never tried to compile PDL from source on Windows. Try Strawberry Perl PDL edition. PDL::IO::Image still needs to be installed from CPAN though.

The decoding is more different than I thought

GD documentation is misleading -- without forcing an image to remain true color, it's appears to be palettized on open:

use strict; use warnings; use GD; use Imager; system 'convert rose: -resize 50% rose.png'; for my $force_true_color ( 0, 1 ) { my $png = GD::Image-> newFromPng( 'rose.png', $force_true_color ); print "GD, \$force_true_color is $force_true_color:\n"; for my $y ( 0 .. 4 ) { for my $x ( 0 .. 4 ) { my @c = $png-> rgb( $png-> getPixel( $x, $y )); print join '/', @c; print "\t"; } print "\n"; } print "\n"; } my $i = Imager-> new( file => 'rose.png' ); print "Imager:\n"; for my $y ( 0 .. 4 ) { for my $x ( 0 .. 4 ) { my @c = $i-> getpixel( x => $x, y => $y )-> rgba; pop @c; print join '/', @c; print "\t"; } print "\n"; } print "\n"; system 'convert rose.png -crop 5x5+0+0 txt:-'; __END__ GD, $force_true_color is 0: 52/48/45 52/48/45 60/50/46 52/48/45 60/50/ +46 44/48/44 44/48/44 52/40/40 44/41/44 52/48/ +45 44/48/44 44/48/44 52/48/45 44/41/44 44/41/ +44 52/55/45 60/56/50 60/56/50 60/50/46 52/48/ +45 60/56/50 60/62/68 68/68/52 76/66/53 68/60/ +51 GD, $force_true_color is 1: 48/47/45 54/50/46 57/49/44 56/48/45 56/49/ +45 44/45/46 47/45/43 48/43/40 46/43/43 49/44/ +43 45/47/47 47/47/46 48/45/42 44/41/41 42/41/ +43 53/54/47 57/56/50 62/56/52 59/52/48 54/51/ +51 56/57/51 64/63/57 70/66/62 72/67/60 70/59/ +47 Imager: 48/47/45 54/50/46 57/49/44 56/48/45 56/49/ +45 44/45/46 47/45/43 48/43/40 46/43/43 49/44/ +43 45/47/47 47/47/46 48/45/42 44/41/41 42/41/ +43 53/54/47 57/56/50 62/56/52 59/52/48 54/51/ +51 56/57/51 64/63/57 70/66/62 72/67/60 70/59/ +47 # ImageMagick pixel enumeration: 5,5,255,srgb 0,0: (48,47,45) #302F2D srgb(48,47,45) 1,0: (54,50,46) #36322E srgb(54,50,46) 2,0: (57,49,44) #39312C srgb(57,49,44) 3,0: (56,48,45) #38302D srgb(56,48,45) 4,0: (56,49,45) #38312D srgb(56,49,45) 0,1: (44,45,46) #2C2D2E srgb(44,45,46) 1,1: (47,45,43) #2F2D2B srgb(47,45,43) 2,1: (48,43,40) #302B28 srgb(48,43,40) 3,1: (46,43,43) #2E2B2B srgb(46,43,43) 4,1: (49,44,43) #312C2B srgb(49,44,43) 0,2: (45,47,47) #2D2F2F srgb(45,47,47) 1,2: (47,47,46) #2F2F2E srgb(47,47,46) 2,2: (48,45,42) #302D2A srgb(48,45,42) 3,2: (44,41,41) #2C2929 srgb(44,41,41) 4,2: (42,41,43) #2A292B srgb(42,41,43) 0,3: (53,54,47) #35362F srgb(53,54,47) 1,3: (57,56,50) #393832 srgb(57,56,50) 2,3: (62,56,52) #3E3834 srgb(62,56,52) 3,3: (59,52,48) #3B3430 srgb(59,52,48) 4,3: (54,51,51) #363333 srgb(54,51,51) 0,4: (56,57,51) #383933 srgb(56,57,51) 1,4: (64,63,57) #403F39 srgb(64,63,57) 2,4: (70,66,62) #46423E srgb(70,66,62) 3,4: (72,67,60) #48433C srgb(72,67,60) 4,4: (70,59,47) #463B2F srgb(70,59,47)

Replies are listed 'Best First'.
Re^5: working with png data
by Anonymous Monk on Sep 26, 2019 at 10:31 UTC

    Many Thanks for your good help !!

    Setting the option force_true_color is solving the difference completly !

    Special thanks to point to Strawberry Perl. Using Strawberry solves some of my install problems !

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found