[Mimedefang] Filter help - convert tiff to pdf

Kevin A. McGrail kmcgrail at pccc.com
Wed May 5 12:32:38 EDT 2004


So you'll need to loop through the MIME Entities on the email, see if any
are TIFFs, run PerlMagick on them to convert to PDF and then replace the
MIME Entity with the new PDF entity. Perhaps David has an idea about the
loop on the mime entities because I don't but are you saying you don't know
enough about perl to go anywhere with this information?

Here's a starting point with the perl code to convert from tif to pdf
assuming you have ImageMagick.  As you can see it's simply a matter of
reading in a tif and writing out a pdf.  The perl API will automatically
trigger a PDF write due to the filename.

#!/usr/bin/perl -w

use strict;
use Image::Magick;

my ($image, $rv);

$image = new Image::Magick;
if ($image) {
  $rv = $image->read("/tmp/pic02376.tif");
  warn "$rv" if "$rv";
  $rv = $image->Write("/tmp/pic02376.pdf");
  warn "$rv" if "$rv";
}


> I would like the process to be automatic using imagemagick's convert
function



More information about the MIMEDefang mailing list