Convert PDF2PNG with Imagick

#!/usr/bin/perl -w
# Needs Imagick convert and Perl to run
    #get all pdf from current directory
        opendir($DIR, ".");
	     @files = grep(/\.pdf$/,readdir($DIR));
        closedir($DIR);

#convert all pdf to png with 300 dpi
       foreach $file (@files) {
	    @dir=split(/\./,$file);
       system("convert -density 300x300 $file $dir[0].png");
	
Advertisements
This entry was posted in Linux, Perl, simpleScripts. Bookmark the permalink.

One Response to Convert PDF2PNG with Imagick

  1. laubb says:

    Thanks!
    the density option is important – as the default of convert usually creates some low res raster images.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s