Menu

gitpiper

Chunky PNG Cheat Sheet in April 2024

Last Updated: 7 April 2024

README.md

Loading

image = ChunkyPNG::Image.from_file('file.png')

Alternate ways

image = ChunkyPNG::Image.from_blob(File.read('file.png'))
image = ChunkyPNG::Image.from_io(io) 

Loads from file.png.

Saving

image.save('filename.png')

Alternate ways

File.open('newfile.png', 'wb') { |io| image.write(io) }
binary_string = image.to_blob

Writes an image to newfile.png.

Drawing

image[0, 0] = ChunkyPNG::Color.rgba(255, 0,0, 128)
image.line(1, 1, 10, 1, ChunkyPNG::Color.from_hex('#aa007f'))

Canvas

crop(x, y, w, h)

Transforms

new_image = image.flip_horizontally.rotate_right

338+ more cheat sheets for you in April 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️