bensonmonk has asked for the wisdom of the Perl Monks concerning the following question:
I want to use ImageMagick to edit an existing image by making some selected points a specific colour.
I am trying to use the Draw command with the ‘point’ primitive. However, I can only get a black point regardless of what colour I am trying to set.
This is shown in the Perl code below where:
1. I draw a blue rectangle;
2. Try and set a number of points to white in a rectangle that partly overlaps the blue rectangle.
However, I get black points in the rectangle.
How can I set white (and any other colour) points?
I am trying to use the Draw command with the ‘point’ primitive. However, I can only get a black point regardless of what colour I am trying to set.
This is shown in the Perl code below where:
1. I draw a blue rectangle;
2. Try and set a number of points to white in a rectangle that partly overlaps the blue rectangle.
However, I get black points in the rectangle.
How can I set white (and any other colour) points?
use Image::Magick; my ($col, $img_width, $row, $img_height); # Create a new image my $im = Image::Magick->new(size => '400x300'); # Give it a white background $im->Read('xc:white'); # Put a rectangle in there somewhere $im->Draw(primitive => 'rectangle', points => '0,129 199,169', fill => 'blue', stroke => 'blue'); for($col = 50; $col < 100; $col ++ ) { for ($row = 150; $row < 200; $row ++ ) { $im->Draw(primitive => 'point', points => "$col,$row", stroke => 'white'); } } $im->Write('pointquery.png');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: ImageMagick Point Query
by zentara (Archbishop) on Nov 22, 2012 at 12:40 UTC | |
by bensonmonk (Novice) on Nov 22, 2012 at 13:02 UTC | |
Re: ImageMagick Point Query
by ColonelPanic (Friar) on Nov 22, 2012 at 13:51 UTC |
Back to
Seekers of Perl Wisdom