class PalletePNG::Image
Constants
- NotPNG
Attributes
image[R]
@return [ChunkyPNG::Image]
Public Class Methods
new(image_data)
click to toggle source
@param [String] image_data The PNG image data @raise [ChunkyPNG::SignatureMismatch] if image_data is not a PNG image
# File lib/pallete_png/image.rb, line 12 def initialize(image_data) @image = ChunkyPNG::Image.from_blob(image_data) end
Public Instance Methods
datastream()
click to toggle source
@return [ChunkyPNG::Datastream]
# File lib/pallete_png/image.rb, line 31 def datastream @datastream ||= image.to_datastream end
pallete_based?()
click to toggle source
# File lib/pallete_png/image.rb, line 21 def pallete_based? color_mode, _depth = image.palette.best_color_settings color_mode == ChunkyPNG::COLOR_INDEXED end
to_truecolor_alpha()
click to toggle source
@return [String] The new image data that the color_mode is converted to TRUE COLOR alpha
# File lib/pallete_png/image.rb, line 17 def to_truecolor_alpha image.to_blob color_mode: ChunkyPNG::COLOR_TRUECOLOR_ALPHA end
transparency_chunk?()
click to toggle source
# File lib/pallete_png/image.rb, line 26 def transparency_chunk? !datastream.transparency_chunk.nil? end