class

CrImage::RGBAImage

Inherits CrImage::Format::WebP < CrImage::Format::JPEG < CrImage::Operation::MaskApply < CrImage::Format::Save < CrImage::Operation::VerticalBlur < CrImage::Operation::Pad < CrImage::Operation::Rotate < CrImage::Operation::HorizontalBlur < CrImage::Operation::HistogramEqualize < CrImage::Operation::GaussianBlur < CrImage::Operation::Draw < CrImage::Operation::Crop < CrImage::Operation::Contrast < CrImage::Operation::ChannelSwap < CrImage::Operation::Brightness < CrImage::Operation::BoxBlur < CrImage::Operation::BilinearResize < CrImage::Format::PNG < CrImage::Format::PPM < CrImage::Image < Reference < Object

An image with red, green, blue, and alpha color channels (i.e. a color image). This image type is likely the one read from and written to file (or IO).

Constructors

from_jpeg(image_data : Bytes) : self

Read image_data as JPEG encoded bytes

from_jpeg(io : IO) : self

Construct an Image from reading in bytes from io

from_png(image_data : Bytes) : self

Read image_data and PNG encoded bytes

from_png(io : IO) : self

Construct an Image by reading bytes from io

from_ppm(image_data : Bytes) : self

Read image_data as PPM encoded bytes

from_ppm(io : IO) : self

Read bytes from io as PPM encoded

from_webp(image_data : Bytes) : self

Read image_data as WebP encoded bytes

from_webp(io : IO) : self

Read bytes from io as WebP encoded

new(red : Array(UInt8), green : Array(UInt8), blue : Array(UInt8), alpha : Array(UInt8), width : Int32, height : Int32)
Source
new(width : Int32, height : Int32)
Source

Instance methods

[](x : Int32, y : Int32) : Color
Source
[](channel_type : ChannelType) : Array(UInt8)

Return the channel corresponding to channel_type

Source
[]=(channel_type : ChannelType, channel : Array(UInt8)) : Array(UInt8)

Set the corresponding channel_type with channel

Source
alpha

Return the alpha channel

Source
alpha=(alpha : Array(UInt8))
Source
blue

Return the blue channel

Source
blue=(blue : Array(UInt8))
Source
clone

Create a copy of this image

Source
each_channel

Run provided block with the ChannelType::Red, ChannelType::Green, and ChannelType::Blue channels.

Source
each_color_channel

Run provided block with the ChannelType::Red, ChannelType::Green, and ChannelType::Blue channels.

Source
green

Return the green channel

Source
green=(green : Array(UInt8))
Source
height

Height of image

Source
height=(height : Int32)
Source
mask_from
Source
red

Return the red channel

Source
red=(red : Array(UInt8))
Source
size

Return the number of pixels in this image

Source
to_gray(red_multiplier : Float = 0.299, green_multiplier : Float = 0.587, blue_multiplier : Float = 0.114) : GrayscaleImage

Convert color image to GrayscaleImage, using the NTSC formula as default values.

Woman with black turtleneck and white background

Becomes

Woman in black turtleneck on white background in grayscale
Source
to_pluto
Source
to_rgba

Returns self

Source
to_stumpy
Source
width

Width of image

Source
width=(width : Int32)
Source