How to join two images with 'GD::Image'

Hi.

I've got two images on my Hard Disk ('pic1.jpg' and 'pic2.jpg') and
would like to join them both into a unique one ('mypic.jpg').

Is it possible with 'GD::Image'? Thank you very much.
Francesco Moi [ Mo, 25 Juni 2007 10:36 ] [ ID #1748173 ]

Re: How to join two images with 'GD::Image'

Francesco Moi wrote:
> I've got two images on my Hard Disk ('pic1.jpg' and 'pic2.jpg') and
> would like to join them both into a unique one ('mypic.jpg').
>
> Is it possible with 'GD::Image'?

Which efforts did you make to find out before asking here?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Gunnar Hjalmarsson [ Mo, 25 Juni 2007 11:49 ] [ ID #1748174 ]

Re: How to join two images with 'GD::Image'

>
> Which efforts did you make to find out before asking here?

I've been browsing
http://search.cpan.org/dist/GD/GD.pm

I didn't find out anything about "joining two images".

I've been searching with Google:
- "join two images" GD::Image perl
- join images GD::Image perl
Francesco Moi [ Mo, 25 Juni 2007 12:32 ] [ ID #1748175 ]

Re: How to join two images with 'GD::Image'

On Mon, 25 Jun 2007 10:32:09 -0000,
Francesco Moi <francescomoi [at] usa.com> wrote:
>>
>> Which efforts did you make to find out before asking here?
>
> I've been browsing
> http://search.cpan.org/dist/GD/GD.pm
>
> I didn't find out anything about "joining two images".

You seem to be making the assumption that "joining two images" is
somehow standard graphics terminology. It isn't as far as I know. I am
assuming that to "join" two images, to you, means displaying them side
by side?

The above link has the complete documentation for GD::Image. What you're
looking for, if the above assumption is right, is the copy() method.

Create a new image, large enough to hold the 'joined' result. Use the
copy() method to put the old images in the appropriate place. Maybe you
need copyMerge if you want them to overlap.

For more complex combination methods between images, you might want to
look at Image::Magick or maybe Imager.

Martien
--
|
Martien Verbruggen | The problem with sharks is that they are too
| large to get to the shallow end of the gene
| pool. -- Scott R. Godin
Martien Verbruggen [ Mo, 25 Juni 2007 13:07 ] [ ID #1748177 ]

Re: How to join two images with 'GD::Image'

Francesco Moi wrote:
>> Which efforts did you make to find out before asking here?
>
> I've been browsing
> http://search.cpan.org/dist/GD/GD.pm
>
> I didn't find out anything about "joining two images".
>
> I've been searching with Google:
> - "join two images" GD::Image perl
> - join images GD::Image perl
>

You have a nomenclature issue: "joining two images" isn't
a very precise description. Presumably you either want to
(a) composite two images, one on top of the other, or (b)
tile the images side by side. If you want (b), see
GD::Tiler. If you want (a), *and* you don't want any alpha
channel effect (ie, semitransparent overlays), then you can
just copy each image into a an output image object. If you
want alpha channels, you may need to consider Imager or
ImageMagick. GD purports to have alpha channel support, but
I've never had much luck getting it to work.

Dean Arnold
Presicient Corp.
Dean Arnold [ Mo, 25 Juni 2007 18:14 ] [ ID #1748179 ]
Perl » comp.lang.perl.modules » How to join two images with 'GD::Image'

Vorheriges Thema: XPath to Line Number?
Nächstes Thema: Device::Modem v1.48 released to CPAN