Sha256: 76697c9f4900ff9301a7b84312ef089cdabaa0a935f8d141befde890c273ec7d
Contents?: true
Size: 789 Bytes
Versions: 3
Compression:
Stored size: 789 Bytes
Contents
require 'chunky_png' class PSD::Image module Export # PNG image export. This is the default export format. module PNG # Load the image pixels into a PNG file and return a reference to the # data. def to_png png = ChunkyPNG::Image.new(width, height, ChunkyPNG::Color::TRANSPARENT) i = 0 height.times do |y| width.times do |x| png[x,y] = ChunkyPNG::Color.rgba( @pixel_data[i], @pixel_data[i+1], @pixel_data[i+2], @pixel_data[i+3] ) i += 4 end end png end alias :export :to_png # Saves the PNG data to disk. def save_as_png(file) to_png.save(file) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
psd-0.3.4 | lib/psd/image_exports/png.rb |
psd-0.3.3 | lib/psd/image_exports/png.rb |
psd-0.3.2 | lib/psd/image_exports/png.rb |