Page 1 of 1

annotate and mpr

Posted: 2008-09-17T10:27:05-07:00
by bablokb
Hi,

I have an (automatically) generated IM command which reads an image, and applies some operator with varying arguments to a given number of "slices" of the image, e.g.:

Code: Select all

convert input.jpg -respect-parenthesis \
                  -fill red \
                  -font Arial -pointsize 15 \
            -write mpr:orig +delete \
     \( \
        \( mpr:orig\[522x3900+0+0\] -tint 0  \
                                    -gravity South \
                                    -fill black \
                                    -splice 0x18 \
                                    -annotate 0x0+0+0 '-tint 0' \
        \) \
        \( mpr:orig\[522x3900+522+0\] -tint 25.000  \
                                    -gravity South \
                                    -fill black \
                                    -splice 0x18 \
                                    -annotate 0x0+0+0 '-tint 25.000' \
        \) +append \
        \( mpr:orig\[522x3900+1044+0\] -tint 50.000  \
                                    -gravity South \
                                    -fill black \
                                    -splice 0x18 \
                                    -annotate 0x0+0+0 '-tint 50.000' \
        \) +append \
        \( mpr:orig\[522x3900+1566+0\] -tint 75.000  \
                                    -gravity South \
                                    -fill black \
                                    -splice 0x18 \
                                    -annotate 0x0+0+0 '-tint 75.000' \
        \) +append \
        \( mpr:orig\[522x3900+2088+0\] -tint 100.000  \
                                    -gravity South \
                                    -fill black \
                                    -splice 0x18 \
                                    -annotate 0x0+0+0 '-tint 100.000' \
        \) +append \
     \)  output.jpg
The example tints the slices with increasing strength. Now the script should also annotate each slice, but it only generates the annoation for "-tint 50.000". If I remove the geometry settings for mpr:orig the annoation works fine, but of course I have a different image (five times the original, no slices).

Seems to me that annotate gets confused with the geometry-settings of the mpr:orig (same effect with draw).

My IM version is 6.4.3

Bernhard

Re: annotate and mpr

Posted: 2008-09-17T21:48:37-07:00
by anthony
Add a +repage afetr each mpr: read.

The read does a 'crop' of the image and as such it leaves the image with a virtual canvas and offset (a layer image). -annotate draws on the virtual canvas so is centered on the virtual canvas, and not the actual image.

+repage resets the virtual cnavs and offset to match the image, making it a 'normal' un-layered image again.