Last active
February 11, 2016 11:08
-
-
Save tsega/c0a338c357bcfc94d09c to your computer and use it in GitHub Desktop.
A ruby command line script to generate jpg's from the first pages of pdf files.
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 | |
# This require that you have ImageMagick and Ghostscript installed and available on your PATH | |
# It also assumes you have you pdf files in `pdfs` folder | |
# Note: Since it generates jpg's it does not handle transparency very well | |
# modify the .jpg to .png to generate png files. | |
Dir['pdfs/*.pdf'].each do |pdf_file| | |
jpg_file = pdf_file.chomp(File.extname(pdf_file)) + ".jpg" | |
system("convert -density 144 #{pdf_file}[0] -resize 200x300 #{jpg_file} ") | |
end |
We could always re-process them, you're right. For now, they need to be high-quality enough to be used wherever our partners might use them, for example:
The size of these is more or less ok, but the quality is horrible.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usually, keeping a high-resolution copy that you could manipulate on the fly is a good idea. Progress in the Responsive Images community is promising in getting rid of the whole device-screen nightmare.