Skip to content

Instantly share code, notes, and snippets.

@jtrim
Created November 3, 2012 21:09
Show Gist options
  • Select an option

  • Save jtrim/4008820 to your computer and use it in GitHub Desktop.

Select an option

Save jtrim/4008820 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
image_data = IO.read('test.png')
pngquant_io = IO.popen('pngquant 16')
pngquant_io.write image_data
pngquant_io.close_write
processed_data = pngquant_io.read
open 'test-processed.png', 'wb' do |f|
f.write processed_data
end
pngquant_io.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment