class ChunkyPNG::Palette

def to_plte_chunk

Other tags:
    See: ChunkyPNG::Palette#can_encode? -

Returns:
  • (ChunkyPNG::Chunk::Palette) - The PLTE chunk.
def to_plte_chunk
  @encoding_map = {}
  colors        = []
  each_with_index do |color, index|
    @encoding_map[color] = index
    colors += ChunkyPNG::Color.to_truecolor_bytes(color)
  end
  ChunkyPNG::Chunk::Palette.new('PLTE', colors.pack('C*'))
end