Sha256: 016cf318cb9d2a58e8893101d6a1420a747d6d74174f81c667a14cceb1c38016
Contents?: true
Size: 547 Bytes
Versions: 2
Compression:
Stored size: 547 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true Dir.chdir(File.dirname(__FILE__)) require 'shellwords' palettes = [64] side = 256 palettes.each do |palette| IO.popen(%W[ convert -depth 8 -size #{side}x#{side} -strip rgb:- PNG24:#{palette}.png ].shelljoin, 'w') do |f| (side * side).times do |i| color = i * palette / (side * side) * 0x10000 / palette f << [color / 0x100, color % 0x100, 0].pack('C*') end end system "identify -format 'Wrote %f with %k unique colors\n' #{palette}.png" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
image_optim-0.26.5 | spec/images/quant/generate |
image_optim-0.26.4 | spec/images/quant/generate |