The CompressedText (zTXt) chunk contains keyword/value metadata about the PNG stream. In this chunk, the value is compressed using Deflate compression.
@see ChunkyPNG::Chunk::CompressedText @see ChunkyPNG::Chunk::InternationalText
# File lib/chunky_png/chunk.rb, line 281 def initialize(keyword, value) super('zTXt') @keyword, @value = keyword, value end
# File lib/chunky_png/chunk.rb, line 286 def self.read(type, content) keyword, compression, value = content.unpack('Z*Ca*') raise ChunkyPNG::NotSupported, "Compression method #{compression.inspect} not supported!" unless compression == ChunkyPNG::COMPRESSION_DEFAULT new(keyword, Zlib::Inflate.inflate(value)) end
Creates the content to write to the stream, by concatenating the keyword with the deflated value, joined by a null character.
@return The content that should be written to the datastream.
# File lib/chunky_png/chunk.rb, line 296 def content [keyword, ChunkyPNG::COMPRESSION_DEFAULT, Zlib::Deflate.deflate(value)].pack('Z*Ca*') end
Generated with the Darkfish Rdoc Generator 2.