Problems with -flatten cropped image in version 6.4.7
Posted: 2008-12-19T04:25:17-07:00
I am trying to composite several images into single image using convert and -flatten. I need to specify certain position for every image. While I used only static files everything worked fine:
convert -size 240x320 \
> -page +0+0 Idle_Background.template.png \
> -page +85+8 .template.color-text-screen-title.png \
...
> -page +0+299 .template.color-text-softkeys-idle.png \
> -flatten -resize 180x240 -quality 100 screen.0.jpg
With this construction I got exactly what I expected. Then it became necessary to add a cropped image into the image queue. The source image that is cropped is:
Digital_Clock.template.png PNG 130x57 130x57+0+0 8-bit DirectClass 1.88kb
From this image I need to crop 53x57+0+0 area and place it on resulting image at position +21+1.
In version 6.4.4 the following construction was used to achieve the desired result:
convert -size 240x320 \
> -page +0+0 Idle_Background.template.png \
> -page +85+8 .template.color-text-screen-title.png \
...
> -page +0+299 .template.color-text-softkeys-idle.png \
> -page +21+1 \( Digital_Clock.template.png -crop 74x58-21-1\! +repage \) \
> -flatten -resize 180x240 -quality 100 screen.0.jpg
I don't fully understand why did it work, but at least it produced the expected result - correct piece of digital clock was placed at +21+1 on resulting image. After update to the version 6.4.7 this construction produces not exactly what I want: cropped piece of digital clock has lesser width that required and is positioned at +0+0. If I change "-page +21+1" to "-page +0+0" it gets cropped correctly but still is positioned at +0+0. I tried different things but did not succeed to place the cropped image at +21+1.
My question is: in given conditions what should I do to place the cropped piece of specified image to position +21+1 from upper left corner of the resulting image? Maybe I wrongly understand how both the -page and parenthesis work?
convert -size 240x320 \
> -page +0+0 Idle_Background.template.png \
> -page +85+8 .template.color-text-screen-title.png \
...
> -page +0+299 .template.color-text-softkeys-idle.png \
> -flatten -resize 180x240 -quality 100 screen.0.jpg
With this construction I got exactly what I expected. Then it became necessary to add a cropped image into the image queue. The source image that is cropped is:
Digital_Clock.template.png PNG 130x57 130x57+0+0 8-bit DirectClass 1.88kb
From this image I need to crop 53x57+0+0 area and place it on resulting image at position +21+1.
In version 6.4.4 the following construction was used to achieve the desired result:
convert -size 240x320 \
> -page +0+0 Idle_Background.template.png \
> -page +85+8 .template.color-text-screen-title.png \
...
> -page +0+299 .template.color-text-softkeys-idle.png \
> -page +21+1 \( Digital_Clock.template.png -crop 74x58-21-1\! +repage \) \
> -flatten -resize 180x240 -quality 100 screen.0.jpg
I don't fully understand why did it work, but at least it produced the expected result - correct piece of digital clock was placed at +21+1 on resulting image. After update to the version 6.4.7 this construction produces not exactly what I want: cropped piece of digital clock has lesser width that required and is positioned at +0+0. If I change "-page +21+1" to "-page +0+0" it gets cropped correctly but still is positioned at +0+0. I tried different things but did not succeed to place the cropped image at +21+1.
My question is: in given conditions what should I do to place the cropped piece of specified image to position +21+1 from upper left corner of the resulting image? Maybe I wrongly understand how both the -page and parenthesis work?