Can't seem to replicate PerlMagick on the command line
Posted: 2013-02-27T09:47:09-07:00
Hello Ladies and Gents,
I'm hitting a bit of a wall, and I hope I can get your assistance!
I've been tasked with re-writing a perl script in Python, and that Perl script uses ImageMagick/PerlMagick to manipulate images.
I've tried using Python's PIL Library, but its not capable of doing one of the tasks as well as ImageMagick.. so in an effort to be quick and simple, I'm working on calling the convert command on the command line from Python to accomplish this one task.
The task is as follows:
Taking a LARGE .tif file and shrinking it, rotating it -5 degrees, making the background transparent, and saving it as a gif (and no, I can't change these requirements)
My Perl script did this quite well, but trying to replicate that on the command line is proving difficult.. here is what I have:
Here is the PerlMagick Code:
Command Line Attempt:
I've also tried Flood Fill and Opaque to change the white border to transparent. The reason for the white border is to "blend" the edges into the white background the image will be dropped on on the web.
Thoughts? I have pretty strict set of requirements regarding edge smoothness, file format, and where it goes on the web space.
I'm hitting a bit of a wall, and I hope I can get your assistance!
I've been tasked with re-writing a perl script in Python, and that Perl script uses ImageMagick/PerlMagick to manipulate images.
I've tried using Python's PIL Library, but its not capable of doing one of the tasks as well as ImageMagick.. so in an effort to be quick and simple, I'm working on calling the convert command on the command line from Python to accomplish this one task.
The task is as follows:
Taking a LARGE .tif file and shrinking it, rotating it -5 degrees, making the background transparent, and saving it as a gif (and no, I can't change these requirements)
My Perl script did this quite well, but trying to replicate that on the command line is proving difficult.. here is what I have:
Here is the PerlMagick Code:
Code: Select all
my $agent4=Image::Magick->new();
my $x4=$agent4->Read($workingfile);
warn $x4 if $x4;
$agent4->Resample(density=>'300x300');
$agent4->Rotate(degrees=>'-5', background=>'white');
$agent4->Resize(geometry=>'194x233');
$agent4->Border(width=>'15.5', height=>'11.5', bordercolor=>'white');
$agent4->FloodfillPaint(geometry=>'0x0', channel=>'All', fill=>'transparent');
$agent4->WriteImage($wf3);
$agent4->WriteImage($wf6);
$agent4->WriteImage($wf4);
Code: Select all
convert agentphoto.tif -resample 300x300 -background none -geometry 194x233 -bordercolor white -border 15.5x11.5 -transparent white -rotate -5 test.gif
Thoughts? I have pretty strict set of requirements regarding edge smoothness, file format, and where it goes on the web space.