#!/usr/bin/ruby require 'fileutils' require 'find' input_dir = ARGV[0] rewrite_dir = "/tmp/crush/" raise("Usage #{$0} dirname") unless input_dir Dir.mkdir(rewrite_dir) unless test(?d, rewrite_dir) Find.find(input_dir) do |file| if file =~ /\.png$/ base_dir = File.dirname(file) base_file = File.basename(file) new_dir = rewrite_dir + base_dir FileUtils.mkdir_p(new_dir) unless test(?d, new_dir) puts(%Q!pngcrush -reduce -brute "#{file}" "#{new_dir}/#{base_file}"!) end endFrom there, you can just do something like: crush.rb images | sh.
Tail error logs to slack for fun and profit
8 years ago
mkdir /tmp/crush; find . -type f -iname *\.png -exec pngcrush -reduce -brute -d /tmp/crush {} \;
ReplyDeleteExcellent blog, I wish to share your post with my folks circle. It’s really helped me a lot, so keep sharing post like this
ReplyDeleteSelenium Training in Chennai | Selenium Training in Bangalore | Selenium Training in Pune