Sha256: 4140b590209ac581890922db4ffa756c68f73c638b49e8b00ef59d9374905736

Contents?: true

Size: 430 Bytes

Versions: 1

Compression:

Stored size: 430 Bytes

Contents

require 'benchmark'
require 'pp'
require 'psd'

file = ARGV[0] || 'examples/images/example.psd'

results = Benchmark.measure "Image exporting" do
  psd = PSD.new(file, parse_layer_images: true)
  psd.parse!

  psd.layer_comps.each do |comp|
    puts "Saving #{comp[:name]} - #{comp[:id]}"
    psd.tree
      .filter_by_comp(comp[:id])
      .save_as_png("./#{comp[:name]}.png")
  end
end

puts Benchmark::CAPTION
puts results.to_s

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bench9000-0.1 vendor/psd.rb/examples/layer_comps.rb