You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wvanbergen edited this page Aug 18, 2010
·
1 revision
ChunkyPNG can import and export images to RMagick quickly, without creating files. You need to require the 'chunky_png/rmagick' file to enable the interoperability. This enables the ChunkyPNG::RMagick.export and ChunkyPNG::RMagick.import methods:
require 'rmagick'
require 'chunky_png/rmagick'
canvas = ChunkyPNG::Canvas.from_file('filename.png')
image = ChunkyPNG::RMagick.export(canvas)
# do something with the image using RMagick
updated_canvas = ChunkyPNG::RMagick.import(image)
updated_canvas.save('filename.png', :fast_rgba)