Posts

Showing posts with the label ImageMagick

Creating JPG images from PDF's using Perl and ImageMagick

One of the things that has always bugged me is the excessive bandwidth that PDF's use when presenting schematics. We also have a fair number of users that aren't computer literate enough to understand what Acrobat Reader is, although this seems to be less of an issue lately. Many of our vendors only supply PDF's, and with the 1000's and 1000's of schematics we have it's just not a good option to manually manipulate each one. Enter ImageMagick. ImageMagick ImageMagick is available for many languages, but I prefer using Perl to manipulate the images. Most of the concepts will be the same regardless of language, even if the syntax is changed. So, to begin, I'll include the module and assign the path I want to convert files from. I've also bolded any items you may want to change for your implementation in all of the code snippets below. #!/usr/bin/perl use Image::Magick; use IO::Dir; my $path = [path to images] ; tie %dir, IO::Dir, $path; At this point, we...

Toys, toys, and more toys.

Image
I enjoy image manipulation. If I can do it via code, even better. For example, the following image will get text added to it because I'm hotlinking (using it from the ToolBarn.com web server from a different site). We're doing that mostly for the benefit of eBay users that decide to use our images. It's resulted in some visits and sales for us, and fewer sales for the eBay users. Of course, nothing is as cool as dynamically created images. When I decide to put a thumbnail of my blog on this page, I created a tool that does that. www.toolbarn.com/web-tools/ has a webpage thumbnail generator now. I've been playing with it for a while, trying to make it display as many pages as possible correctly, and it seems to be working fairly well now. I got a pop-up blocker working, it renders flash properly, and does a few other "Goodies" like timestamping the image and giving a guess as to the PR of the page in the image. Again, simple stuff, but cool none the less. I in...