[Mimedefang] Filter help - convert tiff to pdf

Travis Albrecht TAlbrecht at wernerelectric.com
Wed May 5 13:08:20 EDT 2004


Kevin, you are correct and thanks for the point in the right direction.  
I do have ImageMagick,  Unfortunately I don't know much perl.  
I've tried to get this to work by adding to the filter using
action_external_filter with no luck 

Travis Albrecht

-----Original Message-----
From: mimedefang-bounces at lists.roaringpenguin.com
[mailto:mimedefang-bounces at lists.roaringpenguin.com] On Behalf Of Kevin A.
McGrail
Sent: Wednesday, May 05, 2004 11:33 AM
To: mimedefang at lists.roaringpenguin.com
Subject: Re: [Mimedefang] Filter help - convert tiff to pdf

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

_______________________________________________
Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing
list MIMEDefang at lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang




More information about the MIMEDefang mailing list