Sha256: 76ecbe0d83c019813c84fb8bde384b389b395e4ebbaa8604bde856eb4b0f6d73
Contents?: true
Size: 857 Bytes
Versions: 2
Compression:
Stored size: 857 Bytes
Contents
require 'oily_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 PSD.logger.debug "Beginning PNG export" png = ChunkyPNG::Image.new(width.to_i, height.to_i, 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, :fast_rgba) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
psd-1.0.0 | lib/psd/image_exports/png.rb |
psd-0.4.2 | lib/psd/image_exports/png.rb |