Polaroid Giving Black Background

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
walzmyn

Polaroid Giving Black Background

Post by walzmyn »

I'm trying to use the Polaroid function in conjunction with Montage. I am getting a black background behind the Polaroid and cannot seem to get rid of it.

Here's part of my code, (this is inside a loop).

my $a = (rand(10)-5);
my $rotate=Image::Magick->new;
$rotate->Read($pics[$_]) and warn ($ok);
$rotate->Polaroid(
angle=>$a,
stroke=>'red',
background=>'blue',
);
$rotate->Write($tmp);

I've also tried setting attributes on the $rotate before the Polaroid call, to set background color and basically every thing else I could find associated with color, same results. For the record, I don't need the red and blue colors above, I'm just showing what I've tried to get rid of the black.

In a related problem, once these images are made into Polaroids, I want to montage them. To get them into a single variable to make the montage I'm writing them out and reading them back into a new variable. I'm sure there's a better way. How do you move images from one perlmagick variable. Or, is there a way to work on individual images that are stacked into one variable.

Thanks in advance.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Polaroid Giving Black Background

Post by anthony »

You must enable (set) alpha channel before adding polariod transparency.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply