Sha256: de938d2696e687eb5c90837d7d15cc463acaf2c9f05405a42afd0e405b070cd3
Contents?: true
Size: 723 Bytes
Versions: 23
Compression:
Stored size: 723 Bytes
Contents
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 return @png if @png PSD.logger.debug "Beginning PNG export" @png = ChunkyPNG::Canvas.new(width.to_i, height.to_i, ChunkyPNG::Color::TRANSPARENT) i = 0 height.times do |y| width.times do |x| @png[x, y] = @pixel_data[i] i += 1 end end @png end alias :export :to_png # Saves the PNG data to disk. def save_as_png(file) to_png.save(file, :fast_rgba) end end end end
Version data entries
23 entries across 23 versions & 2 rubygems
Version | Path |
---|---|
psd-2.1.1 | lib/psd/image_exports/png.rb |
psd-2.1.0 | lib/psd/image_exports/png.rb |
psd-2.0.0 | lib/psd/image_exports/png.rb |