Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I think Imager is good enough for this task. Though starting point looks strange to me, but assuming there already is, as in OP, a Perl array of (unusual) ARGB packed colour values, read the 4 channels, then just drop useless 0th channel. Otherwise the hassle with "combine" (or something similar, TMTOWTDI), etc. is unnecessary, of course.

use strict; use warnings; use Imager; use constant IMAGESIZE => 300; use constant ROSYBROWN => 0x00BC8F8F; my @result = map { # make us some picture to find when ( ROSYBROWN ) x $_, # examining output, let it be random int( rand 0xFFFFFFFF ), # colour diagonal on uniform BG ( ROSYBROWN ) x ( IMAGESIZE - $_ - 1 ), } 0 .. IMAGESIZE - 1; my $img = Imager-> new( type => 'raw', xsize => IMAGESIZE, ysize => IMAGESIZE, data => pack( 'L>*', @result ), raw_interleave => 0, raw_datachannels => 4, raw_storechannels => 4, ); Imager-> combine( src => [ $img, $img, $img ], channels => [ 1, 2, 3 ], )-> write( file => 'test.png' );

In reply to Re: How to create and save an image from RGB values by vr
in thread How to create and save an image from RGB values by bliako

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found