Skip to content

Instantly share code, notes, and snippets.

@schacon
Created December 18, 2014 16:25
Show Gist options
  • Save schacon/793c8fdea738fd3d04a7 to your computer and use it in GitHub Desktop.
Save schacon/793c8fdea738fd3d04a7 to your computer and use it in GitHub Desktop.
crush and resize book images
#! /usr/bin/env ruby
require 'rubygems'
require 'oily_png'
Dir.glob("book/**/*.png").each do |file|
puts file
image = ChunkyPNG::Image.from_file(file)
p image.width
p image.height
if image.width > 800 || image.height > 800
if image.width > image.height
`convert -resize 800x #{file} #{file}.smaller.png`
else
`convert -resize x800 #{file} #{file}.smaller.png`
end
`pngcrush #{file}.smaller.png #{file}`
`rm #{file}.smaller.png`
end
end
@keisabably
Copy link

Hello my name is keisa,its give me please to write you after going through your profile i will like to be in communication with you kindly write me(keisafreya@yahoo.co.uk) for a deal. thanks

@coxdenis32
Copy link

Thanks for the recommendation letter. I would like to order a book.

@finistratbob
Copy link

I would like to know about the possibility of posting books on your blog. I recently found a cool example of posting textbook reviews https://freebooksummary.com/category/between-shades-of-gray online and loved this template. I want to create a thematic space for lovers of interactive books and smart searches. My dream is to create an online free library without ads and banners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment