struct PNG::Header

Defined in:

png/header.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(width : UInt32, height : UInt32, bit_depth : UInt8 = 8_u8, color_type : PNG::ColorType = ColorType::TrueColor, compression_method : PNG::CompressionMethod = CompressionMethod::Deflate, filter_type : PNG::FilterType = FilterType::Adaptive, interlacing : PNG::Interlacing = Interlacing::None) #

[View source]

Class Method Detail

def self.parse(io : IO) #

[View source]

Instance Method Detail

def bit_depth : UInt8 #

[View source]
def bit_depth=(bit_depth : UInt8) #

[View source]
def bits_per_pixel : UInt32 #

Number of bits to represent a pixel. Ex: 4bits @ rgb color would be 4 * 3 = 12


[View source]
def byte_size #

Total bytesize including row padding, not including filter bytes


[View source]
def bytes_per_pixel : UInt8 #

Number of bytes to represent a pixel. Ex: 4bits @ rgb color would be ceil((4 * 3) / 8) = 2 This includes extra padding.


[View source]
def bytes_per_row(width : Int = @width) #

Row size including padding where bit depth doesn't align to bytes. Not including filter byte.


[View source]
def channels(*args, **options) #

[View source]
def channels(*args, **options, &) #

[View source]
def color_type : ColorType #

[View source]
def color_type=(color_type : ColorType) #

[View source]
def colorize(colors : Indexable(UInt8), palette : Palette | Nil = nil) #

Convert bytes into a color struct


[View source]
def compression_method : CompressionMethod #

[View source]
def compression_method=(compression_method : CompressionMethod) #

[View source]
def filter_type : FilterType #

[View source]
def filter_type=(filter_type : FilterType) #

[View source]
def height : UInt32 #

[View source]
def height=(height : UInt32) #

[View source]
def interlacing : Interlacing #

[View source]
def interlacing=(interlacing : Interlacing) #

[View source]
def width : UInt32 #

[View source]
def width=(width : UInt32) #

[View source]
def write(io : IO) #

[View source]