Page 1 of 1

Clone question

Posted: 2018-04-01T03:11:12-07:00
by Bonzo
With the code below I am expecting to get the coloured rose image resized with a monochrome version over it. I am more interested in getting the clone to work. My final image will have three different images with different effects layerd on each other. So I want to use the -resize 500x500 +repage image modified two more times.

Code: Select all

convert rose: ( -resize 500x500 +repage ) ( -clone 1 -resize 300x300 +repage  -monochrome ) -layers merge test.jpg
Error "No such image -clone" I would have thought the original image is -clone 0 and the resized version is -clone 1

Code: Select all

convert rose: ( -resize 500x500 +repage ) ( -clone 0 -resize 300x300 +repage  -monochrome ) -layers merge test.jpg
Just get the final 300px wide monochrome image

This is the result I am looking for using mpr although last night I could not get that to work either!

Code: Select all

convert rose: -write mpr:image +delete ( mpr:image  -resize 500x500 +repage ) ( mpr:image -resize 300x300 +repage  -monochrome ) -layers merge test.jpg

Re: Clone question

Posted: 2018-04-01T04:07:22-07:00
by snibgo
Open parenthesis "(" starts a new empty image list. "-resize" will resize all the images in the current list, but at that point you have no images. IM v7 will reject that command. V6 will take a guess at what you really want. Perhaps you intended to "-clone 0" after the open parenthesis.

Then you "-clone 1", which only works if you have at least two images, because the first in numbered zero.

Code: Select all

convert rose: ( -clone 0 -resize 500x500 +repage ) ( -clone 1 -resize 300x300 +repage  -monochrome ) -layers merge test.jpg
This gives three images layered ogether: the original rose, hidden behind a larger version, with a monochrome version on top.

Re: Clone question

Posted: 2018-04-01T04:29:28-07:00
by Bonzo
Thank you for the explanation snibgo; I was going around in circles last night trying to get it to work!

In actual use the original image will be larger and I only need the two modified images so I have added a -delete 0 before the -layers merge.

Re: Clone question

Posted: 2018-04-01T04:52:23-07:00
by snibgo
A simple alternative is to remove the first parenthesis pair:

Code: Select all

convert rose: -resize 500x500 +repage ( -clone 0 -resize 300x300 +repage  -monochrome ) -layers merge test.jpg
We read the rose and resize it. Then we clone it, resize and make it monochrome. So we have two images, which we merge.