module BMP
Constants
- BITS_PER_PIXEL
- HEADER_SIZE
- VERSION
Public Instance Methods
new(input_filename)
click to toggle source
@param input_filename [PNG] including path @return [BitStruct]
# File lib/bmp.rb, line 32 def new(input_filename) img = ChunkyPNG::Image.from_file(input_filename) img_hash = BMP::Utils.parse_image(img) bmp = BMP::Obj.new bmp.file_size = img_hash[:file_size] bmp.image_size = img_hash[:image_size] bmp.image_width = img_hash[:image_width] bmp.image_height = img_hash[:image_height] bmp.pixel_array = img_hash[:pixel_array] bmp end
png_to_bmp(input_filename, output_filename)
click to toggle source
PNG to BMP
@param input_filename [String] “/path/to/example.png” @param output_filename [String] “/path/to/example_generated.bmp” @return [void]
# File lib/bmp.rb, line 22 def png_to_bmp(input_filename, output_filename) bmp = BMP.new(input_filename) IO.write(output_filename, bmp) end