Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pngquant worker #52

Merged
merged 12 commits into from
Aug 18, 2014
Prev Previous commit
Next Next commit
add generator script and a 64 colour test png
  • Loading branch information
toy committed Aug 7, 2014
commit 15268b599e865a0f9b381c36c7926c199e6fc6d3
Binary file added spec/images/quant/64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions spec/images/quant/generate
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env ruby

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