<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Dev411 Blog: Category imagemagick</title>
    <link>http://www.dev411.com/blog/tag/imagemagick</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>John Wang on Technology</description>
    <item>
      <title>Automated web screen shots with Perl</title>
      <description>&lt;p&gt;I've been looking for a program that will take full screen shots of web pages even when the web page is larger than the window size on my physical screen, requiring scrolling. This morning I found such a program in Petr &#352;mejkal's &lt;a href="http://search.cpan.org/~psme/Win32-CaptureIE-1.30/CaptureIE.pm" class="fix"&gt;Win32::CaptureIE&lt;/a&gt; when it was mentioned by Displeaser on &lt;a href="http://forums.devshed.com"&gt;DevShed Forums&lt;/a&gt; in the "&lt;a href="http://forums.devshed.com/perl-programming-6/screenshot-of-webpage-370275.html"&gt;Screenshot of webpage&lt;/a&gt;" thread. It uses ImageMagick for image manipulation.&lt;/p&gt;

&lt;p&gt;From reading the &lt;span class="fix"&gt;Win32::CaptureIE&lt;/span&gt; POD, the CapturePage function does exactly what I want:&lt;/p&gt;

&lt;div class="quote_simple"&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;CapturePage ( )&lt;/strong&gt; Captures whole page currently loaded in the Internet Explorer window. Only the page content will be captured - no window, no scrollbars. If the page is smaller than the window only the occupied part of the window will be captured. If the page is longer (scrollbars are active) the function will capture the whole page step by step by scrolling the window content (in all directions) and will return a complete image of the page.&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;After installing ImageMagick, &lt;span class="fix"&gt;Image::Magick&lt;/span&gt; and &lt;span class="fix"&gt;Win32::CaptureIE&lt;/span&gt; on my Windows / ActiveState Perl system, I generated &lt;a href="/images/articles/200607/dev411blog_win32captureie.png"&gt;this screen shot&lt;/a&gt; with the following short program using no additional processing:&lt;/p&gt;

&lt;pre&gt;#!perl
use strict; use warnings;
use Win32::CaptureIE;

StartIE( width =&gt; 900 );
Navigate( 'http://www.dev411.com/blog/' );

my $img = CapturePage();
$img-&gt;Write( 'capture.png' );
QuitIE;&lt;/pre&gt;

&lt;p&gt;Perl and CPAN continue to amaze me with their treasure trove of functionality. Are there  similar tools for using Firefox, Linux, other image libraries or languages?&lt;/p&gt;

&lt;div class="update"&gt;&lt;p&gt;&lt;b&gt;UPDATE:&lt;/b&gt; ishnid has found two programs with CLIs (posted to the same thread):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://khtml2png.sourceforge.net/"&gt;khtml2png&lt;/a&gt; on SourceForge. This is a command-line program that looks like it can be run without a browser. It uses &lt;span class="fix"&gt;libkhtml&lt;/span&gt; (used by Konqueror) and ImageMagick's &lt;span class="fix"&gt;convertn&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://pearlcrescent.com/products/pagesaver/"&gt;Pearl Crescent Page Saver&lt;/a&gt;, a commercial app but available in a free version. This is a Firefox extension and requires the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;UPDATE 2:&lt;/b&gt;: I recently tried Win32::CaptureIE with ImageMagick 6.3.0 and it doesn't work. Apparently there used to be a link to "PerlMagick" in older versions of ImageMagick that may not exist anymore. Unfortunately Win32::CaptureIE relies on PerlMagick.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;UPDATE 3:&lt;/b&gt;: I just tried the free version of Pearl Crescent with Firefox 1.5.0.7 which it says it should support but I get a "Download error" with pageserverbasic-1.3.xpi.&lt;/p&gt;

&lt;/div&gt;</description>
      <pubDate>Fri, 21 Jul 2006 10:02:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:829678746bcf7e466ae1a607174ea863</guid>
      <author>John Wang</author>
      <link>http://www.dev411.com/blog/2006/07/21/automated-web-screen-shots-with-perl</link>
      <category>imagemagick</category>
      <category>ie</category>
      <category>perl</category>
    </item>
    <item>
      <title>Catalyst and image libraries</title>
      <description>&lt;p&gt;I just migrated my Catalyst app to use &lt;a href="http://www.boutell.com/gd/"&gt;GD&lt;/a&gt; instead of &lt;a href="http://www.imagemagick.org"&gt;ImageMagick&lt;/a&gt; based on some reported compatibility issues.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chris Laco reported &lt;a href="http://lists.rawmode.org/pipermail/catalyst/2006-March/006166.html"&gt;Apache2/mod_perl2 would core dump with ImageMagick (on FreeBSD)&lt;/a&gt;. He moved to FastCGI+ImageMagick first and is now using FastCGI+&lt;a href="http://imager.perl.org"&gt;Imager&lt;/a&gt;. ImageMagick has been reported to work with Mason+Apache1.x+mod_perl1.3.&lt;/li&gt;
&lt;li&gt;Andreas Marienborg reported on &lt;span class="fix"&gt;#catalyst&lt;/span&gt; IRC that Imager doesn't work with Catalyst+&lt;a href="http://par.perl.org"&gt;PAR&lt;/a&gt; and has moved to GD.&lt;/li&gt;
&lt;li&gt;Someone on &lt;span class="fix"&gt;#rubyonrails&lt;/span&gt; IRC mentioned having problems with RMagick and was looking to migrate to ruby-gd&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wanting the best of all worlds, I moved to GD which also has a smaller memory footprint than ImageMagick. I ended up writing my own wrapper for Lincoln Stein's GD module using the Image::Magick API (drop-in replacement for a very limited set of functionality) though something like &lt;a href="http://search.cpan.org/~lgoddard/Image-Thumbnail-0.62/lib/Image/Thumbnail.pm"&gt;Image::Thumbnail&lt;/a&gt;, which provides a uniform interface to GD, ImageMagick and Imager, is probably better for general use.&lt;/p&gt;

&lt;p&gt;Thanks to Chris and Andreas for their reporting issues. Hopefully I'll be all set with GD.&lt;/p&gt;

</description>
      <pubDate>Tue, 18 Jul 2006 23:05:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:57b4add3580c4de20c6bb9f96bd74e83</guid>
      <author>John Wang</author>
      <link>http://www.dev411.com/blog/2006/07/18/catalyst-and-image-libraries</link>
      <category>imagemagick</category>
      <category>catalyst</category>
    </item>
  </channel>
</rss>
