Class ChunkyPNG::Chunk::CompressedText
In: lib/chunky_png/chunk.rb
Parent: Base

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

Methods

content   new   read  

Attributes

keyword  [RW] 
value  [RW] 

Public Class methods

[Source]

     # File lib/chunky_png/chunk.rb, line 281
281:       def initialize(keyword, value)
282:         super('zTXt')
283:         @keyword, @value = keyword, value
284:       end

[Source]

     # File lib/chunky_png/chunk.rb, line 286
286:       def self.read(type, content)
287:         keyword, compression, value = content.unpack('Z*Ca*')
288:         raise ChunkyPNG::NotSupported, "Compression method #{compression.inspect} not supported!" unless compression == ChunkyPNG::COMPRESSION_DEFAULT
289:         new(keyword, Zlib::Inflate.inflate(value))
290:       end

Public Instance methods

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.

[Source]

     # File lib/chunky_png/chunk.rb, line 296
296:       def content
297:         [keyword, ChunkyPNG::COMPRESSION_DEFAULT, Zlib::Deflate.deflate(value)].pack('Z*Ca*')
298:       end

[Validate]