struct PNG::Header
- PNG::Header
- Struct
- Value
- Object
Defined in:
png/header.crConstructors
Class Method Summary
Instance Method Summary
- #bit_depth : UInt8
- #bit_depth=(bit_depth : UInt8)
-
#bits_per_pixel : UInt32
Number of bits to represent a pixel.
-
#byte_size
Total bytesize including row padding, not including filter bytes
-
#bytes_per_pixel : UInt8
Number of bytes to represent a pixel.
-
#bytes_per_row(width : Int = @width)
Row size including padding where bit depth doesn't align to bytes.
- #channels(*args, **options)
- #channels(*args, **options, &)
- #color_type : ColorType
- #color_type=(color_type : ColorType)
-
#colorize(colors : Indexable(UInt8), palette : Palette | Nil = nil)
Convert bytes into a color struct
- #compression_method : CompressionMethod
- #compression_method=(compression_method : CompressionMethod)
- #filter_type : FilterType
- #filter_type=(filter_type : FilterType)
- #height : UInt32
- #height=(height : UInt32)
- #interlacing : Interlacing
- #interlacing=(interlacing : Interlacing)
- #width : UInt32
- #width=(width : UInt32)
- #write(io : IO)
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)
#
Class Method Detail
Instance Method Detail
def bits_per_pixel : UInt32
#
Number of bits to represent a pixel. Ex: 4bits @ rgb color would be 4 * 3 = 12
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.
def bytes_per_row(width : Int = @width)
#
Row size including padding where bit depth doesn't align to bytes. Not including filter byte.
Convert bytes into a color struct