Originally published on: Sun, 26 Apr 2009 14:46:51 +0000
I often receive e-mails from friends containing humorous images. One of my friends had forwarded an e-mail with a few dozen very funny images attached to it. I found the pictures to be so funny that I felt like posting them to an online forum that I frequent.
Unfortunately, this forum's image-upload feature only allowed for one image at a time to be uploaded. I was hoping to upload them as a group.
I had considered trying to capture some screenshots of a screenful each. An attempt at capturing, cutting, positioning, ...etc. proved to be tedious. I wanted a solution that I could use again. My thoughts turned immediately to the Perl interface to the ImageMagick library: PerlMagick.
Please note that ImageMagick libraries exist for many different programming languages. An ActiveX version is available so that any ActiveX-aware programming language ( including VBScript and Javascript WSH scripts ) can leverage ImageMagick. I had used PerlMagick before and often find good Perl examples via web-searches. I tend to think of PerlMagick and ImageMagick synonymously.
I found a sample program on the web that used the ImageMagick Append() method. When calling the Append() method, one may set the stack parameter attribute to true to force the newly-generated image to be comprised of a top-down set of all of the images in the image object, "stacked" on top of one another.
The following code reads for JPEG images ( i1.jpg, i2.jpg, i3.jpg, and i4.jpg ) and generates an image called stack.jpg that contains all of the above:
Unless otherwise noted, all code and text entries are Copyright ©2009 by James K. Lawless
Save to del.icio.us
Save to StumbleUpon
Digg it
Save to Reddit
Share on Facebook
Share on Twitter
More bookmarks
Subscribe!
Auto Save Clipboard Images Redux
Extending SpiderMonkey JavaScript on Windows
Rhino JavaScript to EXE with launch4j
Compiling Rhino JavaScript to Java
Directory Traversal in Rhino JavaScript
A Command-Line MP3 Player for Windows
Auto Save Images from the Clipboard
Java in a Windows EXE with launch4j
An Interview with Tom Zimmer: Forth System Developer
Setting Windows Console Text Colors in C
Preventing Windows Screen-Saver Activation
Preserving my Favorite HN Links
An Interview with Brad Templeton
Windows Text to Speech in WSH JavaScript
Compiling Rhino JavaScript to Java
MicroISV on a Shoestring
DadHacker
The Bottom Feeder
Writin' That Code!
The Recursive ISV
The Thomsen Blog
Prototypically Speaking
The Reinvigorated Programmer