"Kelvin Park" on  wrote...
| I've been trying to make this work for long hours now, I got to the point
| where I could composite two images.
|
You have given a LOT of separte problems.

| However I'm currently having trouble with (1)"reading multiple images",
|
You are using magick Wand, so read in each image into a difference wand

This can be important for some image fromat like GIF, which can save
multiple images per image file!  A separate magic wand ensures the
individual 'lists' of images remains separate.

Using multiple image lists like this is next to imposible using the
command line API "convert" command, which was why "mogrify" was created.
It is also why mogrify has problems doing composition.

| then individually (2)"compositing them on different canvases"
|
Hav ethe canvases in different Wands too.

| and then (3)"writing them as the same name as the orginal images".
|
The original name for each image should remain with the meta-data for
that image.  however that meta-data is only preserved if that image was
used as a destination or background canvas!!!

That is the way composition works, it makes a clone of the destination,
then modifies that clone with the source image, as asuch the meta-data
is of the destination not the close.

The only exception to this is in regard to a special case of using the
new two image list Layer Composition  (-layers composite)
   http://www.imagemagick.org/Usage/anim_mods/#composite
If the destination is a single 'static' image, the animation meta-data
of the source image is copied to the overlayed images, so as to preserve
the animation timings.
   http://www.imagemagick.org/Usage/anim_mods/#composite_single
In all other cases the destination LIST provides the animation meta-data
as per normal.  That includes the one image list to one image list case.

WARNING: Only the new "-layers composite" can compose images using both
a virtual canvas offsets (as used for GIF animations, not gravity
effected) as well as the more normal composite 'geometry' offset
(which is gravity effected).


Basically if you want to preserve the source images filename, then
either do so in your own program data-structure (the API language way),
or transfer the filename meta-data from source to destination (the IM
way).  When you write you then lookup the filename (from the API or IM
data as appropriate), and write it.

Alturnativally,  invert the composition and 'Underlay' (using "DstOver"
compose) http://www.imagemagick.org/Usage/compose/#dstover
to place the canvas image 'under' the main image.  The main image is
then a compose 'destination' so all aspects of that image is preserved,
including the filename.  However it also means the 'size' is also
preserved!!!!

| Also, (4)"How do you center the original image on the
| canvas?" I tried using DrawSetGravity(), but I just didn't know how to get
| an image centered rather than a line of text.
|
Draw will only used gravity for text and image (composition) placement.
If centering use a geometry offset of 0.

    image Over 0 0 0 0 "imagefile"

I do not know if draw can do image composition from a non-file source.
Probably not.   Can anyone enlighten?

| Here is the "main" flow of the current program:
| 1. Read an original image
| 2. Create a 640x480 white canvas
| 3. Composite original image on to the canvas
| 4. Write the composited image on to a jpeg file.
|
Better...
  1. Read an original image
  2. Enlarge virtual canvas to 640x480
  3. Flatten image with a white background
     (watch for multi-image GIF animations)
  4. Write 'flattened' image.

Note: Jpeg is not a multi-image format, so you may need to figure out
what you want done for multi-image file format inputs.


Also see...  mogrify, image compostion...
   http://www.imagemagick.org/Usage/basics/#mogrify_compose


  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
   "Remember I'm a hologram, don't try these stunts at home."
                  -- Larry Niven & Steven Barnes, "The Barsoom Project"
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to