I suspected result on Linux be wilder than "wrong_setup" because terminals are almost certain to use palette, not pure RGB. "Security"? Life corrects as always.

################################## ########### Deal with image ################################## use PDL::IO::FlexRaw; my $image; { my $im = Imager-> new( file => $image_file ) -> to_rgb8 -> convert( preset => 'noalpha' ) -> scale( xscalefactor => 1, yscalefactor => 1 / $distortion ); my $w_r = $cols / $im-> getwidth; my $h_r = $rows / $im-> getheight; my $ratio = $w_r < $h_r ? $w_r : $h_r; $im = $im-> scale( scalefactor => $ratio ) if $ratio < 1; $im-> write( data => \my $buf, type => 'raw' ); my $dims = [ 3, $im-> getwidth, $im-> getheight ]; open my $fh, '<:raw', \$buf; $image = readflex( $fh, [{ Type => 'byte', Dims => $dims }]) }

TIMTOWTDI. One reason to use PDL::IO::Image was to play with its rescale filters (which amounted to nothing) to average glyph bitmap to single pixel. In the end it's arithmetic mean with Imager::scale(qtype => 'mixing',... and itself not necessary neither, could be unpack '%32C*', ...

(Another reason for PDL::IO::Image was to use the best what happened to image IO and basic manipulation, for PDL if not Perl. Very sad if it's abandoned. PDL::IO::GD and PDL::IO::Pic don't compare)


In reply to Re^4: Imagecat - show color images in a terminal by Anonymous Monk
in thread Imagecat - show color images in a terminal by cavac

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, 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:
    & &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.