in reply to create PNG image

You can use SetPixel method for that. There's documentation at http://www.imagemagick.org/script/perl-magick.php

Replies are listed 'Best First'.
Re^2: create PNG image
by advix (Initiate) on Sep 25, 2010 at 21:55 UTC
    I've tried SetPixel method but couldn't find how to write pixel by pixel in grayscale with 10-bit values(0~1023). Thanks @pixels = $image->GetPixel(x=>1,y=>1); $pixels[0]*=0.5; $image->SetPixel(x=>1,y=>1,color=>\@pixels); # this is color information $image->Quantize(colorspace=>'gray');

      Here's some example code:

      use strict; use warnings; use Image::Magick; my $image = Image::Magick->new( size => '1024x100', type => 'Greyscale', depth => 16, ); $image->Read('xc:white'); for ( 0 .. 1023 ) { my $color = sprintf "gray(%2.3f%%)", 100 * $_ / 1023; my $res = $image->Draw( primitive => 'line', stroke => $color, points => "$_,0 $_,100", ); warn $res if $res; } for ( 0 .. 16 ) { $image->SetPixel( x => int( (16 - $_) * 1023 / 16 ), y => 50, color => [ ( $_ / 16 ) x 3 ], ); } my $res = $image->Write( filename => "grey.png" ); warn $res if $res;

      Why are you ignoring Markup in the Monastery? Also there's bold warning below post text area: Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!

      Update: added SetPixel demo