#!/usr/bin/perl use strict; use warnings; use Image::Magick; my $image = Image::Magick -> new; $image -> Set(size => '10x10'); $image -> ReadImage ('canvas:red'); my ($width, $height) = $image->Get('width', 'height'); my %myRGB; $myRGB{'0,0'} = [ 1, .5, 0 ]; $myRGB{'5,5'} = [ 0, 1, 0 ]; $myRGB{'3,2'} = [ 1, 1, .2 ]; $myRGB{'4,8'} = [ 0, 0, 1 ]; for my $x (0..$width-1) { for my $y (0..$height-1) { if (exists $myRGB{"$x,$y"}) { $image -> SetPixel (x=>$x, y=>$y, color => $myRGB{"$x,$y"} ) } } } $image -> Write ('test.png');