Created
December 18, 2014 16:25
-
-
Save schacon/793c8fdea738fd3d04a7 to your computer and use it in GitHub Desktop.
crush and resize book images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
Thanks for the recommendation letter. I would like to order a book.
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
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([email protected]) for a deal. thanks