Forum: Ruby Getting the color of a pixel

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cf9604f9c5c7c8da4d8fb64d5be00004?d=identicon&s=25 Thomas (Guest)
on 2005-12-26 22:13
Hi,

I have a few questions about RMagick:

1. How do I get the color of a specific pixel? (By giving it the
coordinates of the pixel)
2. How do I store parts of a picture to a file? (So like everything
between points (3,7) and (90,300))

Thanks,

Thomas
0f07a2117ccce0aa66069cb31d22168f?d=identicon&s=25 Antonio Cangiano (Guest)
on 2005-12-26 22:35
(Received via mailing list)
Thomas wrote:
> Hi,

Hi Thomas,

> 1. How do I get the color of a specific pixel? (By giving it the
> coordinates of the pixel)

Image.pixel_color:
http://www.simplesystems.org/RMagick/doc/image2.ht...

> 2. How do I store parts of a picture to a file? (So like everything
> between points (3,7) and (90,300))

You could use:
Image.crop(x, y, width, height)

Where x and y are the offsets of the rectangle relative to the
upper-left corner of the image. width and height are the dimensions of
your desidered region.
http://www.simplesystems.org/RMagick/doc/image1.html#crop


Cheers,
Antonio
This topic is locked and can not be replied to.