Sha256: 6b67f59dba6bdbe06b70b59e736544c694840564950bd53c44a7989459f5ecd5

Contents?: true

Size: 539 Bytes

Versions: 10

Compression:

Stored size: 539 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**2).times do |i|
      color = i * palette / (side**2) * 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

10 entries across 10 versions & 1 rubygems

Version Path
image_optim-0.31.4 spec/images/quant/generate
image_optim-0.31.3 spec/images/quant/generate
image_optim-0.31.2 spec/images/quant/generate
image_optim-0.31.1 spec/images/quant/generate
image_optim-0.31.0 spec/images/quant/generate
image_optim-0.30.0 spec/images/quant/generate
image_optim-0.29.0 spec/images/quant/generate
image_optim-0.28.0 spec/images/quant/generate
image_optim-0.27.1 spec/images/quant/generate
image_optim-0.27.0 spec/images/quant/generate