in reply to merging two .gif or jpg (overlapping)

Yes, ImageMagick is probably a good idea for this.  I don't know offhand whether it natively supports merging two images, but you could convert the images to XPM, and then perform your own image manipulation on the lines from the XPMs.

Here's an example (from some code I recently wrote) of a subroutine for doing this called convert_image_to_xpm() :

#!/usr/bin/perl -w # # A subroutine for reading jpg and gif images, and converting # them to XPM format # # 060106 liverpole # ############## ### Strict ### ############## use strict; use warnings; ################# ### Libraries ### ################# use File::Basename; use FileHandle; use Image::Magick; ################### ### Subroutines ### ################### sub convert_image_to_xpm($) { my ($fname) = @_; print "=== Converting file $fname to XPM format ===\n"; my $image = new Image::Magick(); my $result = $image->Read($fname); $result and die "Error reading image file '$fname' ($result)\n"; print "Read image '$fname', now writing ...\n"; my $tmp = "convert.$$.xpm"; $result = $image->Write($tmp); $result and die "Error writing .xpm file '$tmp' ($result)\n"; my $fh = new FileHandle(); open($fh, "<$tmp") or die "Cannot read file '$fname' ($!)\n"; chomp (my @lines = <$fh>); close $fh; print "Converted image to .xpm format\n"; unlink $tmp; return \@lines; } #################### ### Main program ### #################### my $iam = basename $0; (my $img = shift) or die " syntax: $iam <image file> Demonstrates usage of the subroutine convert_image_to_xpm, for converting a given .jpg or .gif <image file> to XPM format. "; my $plines = convert_image_to_xpm($img); foreach my $line (@$plines) { print "$line\n"; }
Once it's converted to XPM format, it's very easy to manipulate the image any way you want to.

One other note -- if you're a fan of gvim, when you edit an XPM image, it does something pretty cool:  it renders the actual colors for each pixel in the image.  (Don't try it for images which are too large, though).  This makes it very easy to see how the XPM will display, as well as edit it at the same time.


@ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"