Created
November 2, 2011 20:26
-
-
Save ciscou/1334795 to your computer and use it in GitHub Desktop.
Extracts a section of a page of a PDF into a JPG image
This file contains hidden or 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
| pdf_file = "QR Creator.pdf" | |
| pdf_page = 1 | |
| jpg_file = "QR Creator.jpg" | |
| qrcode_offset = [1330, 590] | |
| qrcode_size = [1024, 1024] | |
| output = %x(convert -density 300 -quality 95 -crop #{qrcode_size.join 'x'}+#{qrcode_offset.join '+'} -resize 50% "#{pdf_file}[#{pdf_page - 1}]" "#{jpg_file}") | |
| if $?.success? | |
| puts "OK" | |
| else | |
| puts output | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment