a few comments:
- try $b->{debug} = 1; between 'new' and 'brand' lines ... anything useful?
- note you should probably pass a format=>'jpg' param as well (happens to default to jpg)
- is the target really 'xjpg' or should that be 'x.jpg'? maybe w/o an extension Image::Magick can't figure it out?
- Do you have the proper libs installed? Can you use straight IM code (two new/Read's and a Composite) and does that work?
use Image::Magick;
my $image = Image::Magick->new();
$image->ReadImage( 'x.jpg' );
my $pic = Image::Magick->new();
$pic->ReadImage( 'x.gif' );
$pic->Scale( width=>$w, height=>$h );
$image->Composite( image=>$pic, x=>$x, y=>$y, compose=>'Over' );
$image->Write( 'xb.jpg' );
- note that Image::Magick::Brand is just a very simple (and limited) wrapper around the Composite() method so if the problem is there it's easy enough to just not use it .. (see above item for code)
Also, using
Imager may be an alternative:
use Image;
my $image = Imager->new;
$image->read(file=>'x.jpg', type=>'jpeg') or die "Cannot read:
+ ", $image->errstr;
my $pic = Imager->new;
$pic->read(file=>'x.gif', type=>'gif') or die "Cannot read: ",
+ $pic->errstr;
$image->paste( left=>$x, top=>$y, img=>
$pic->scale( xpixels=>$w, ypixels=>$h, type=>'min' ),
);
$image->write(file=>"xb.jpg");
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.