Module: BMP
- Extended by:
- BMP
- Included in:
- BMP
- Defined in:
- lib/bmp.rb,
lib/bmp/obj.rb,
lib/bmp/utils.rb,
lib/bmp/version.rb
Defined Under Namespace
Constant Summary collapse
- HEADER_SIZE =
54- BITS_PER_PIXEL =
32- VERSION =
'0.1.1'
Instance Method Summary collapse
Instance Method Details
#new(input_filename) ⇒ BitStruct
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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) ⇒ void
This method returns an undefined value.
PNG to BMP
22 23 24 25 26 |
# 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 |