On Tue, 21 Oct 2008 12:43:05 -0400
Michael Stroh <[EMAIL PROTECTED]> wrote:


>I'm using simple commands like
>
>convert lightcurve.eps lightcurve.png
>
>Are there any additional things I can try to get the .png file to look  
>the way I want it to?

Here is a Perl script that does the conversion, and avoids a temp pdf file
by using a blob.

#!/usr/bin/perl
use warnings;
use strict;
use Image::Magick;

# a shell script equivalent... for comparison
#convert -resize 99% -density 160x160 -quality 100% -compress Lossless 
lightcurve.eps lightcurve1.pdf
#convert -quality 100% -compress Lossless lightcurve1.pdf lightcurve1.png
#convert lightcurve1.png -trim lightcurve2.png
#convert -bordercolor SkyBlue -border 40x40 lightcurve2.png  lightcurve3.png

my $img = Image::Magick->new;
$img->Read('lightcurve.eps');
$img->Resize('101%');  #needed hack for portrait/landscape conversion
$img->set('quality'=> 100, );
$img->set('compresion'=> 'LosslessJPEG' );
#$img->Write(filename=>'zzimage.pdf'); #works good when written to temp file
# but using an inline blob here to avoid a temp file
$img->set('magick'=>'pdf');
my $blob = $img->ImageToBlob();

#and the opposite
my $img1 = Image::Magick->new(magick=>'pdf');
$img1->BlobToImage( $blob );
$img1->set('quality'=> 100, );
$img1->set('compresion'=> 'LosslessJPEG' );

#add a border
$img1->Border('bordercolor' => 'SkyBlue','width'=>40,'height'=>40);

$img1->Write(filename=>'zzzimage.jpg');
$img1->Write(filename=>'zzzimage.png');

__END__


zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html 
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to