Page 1 of 1
How to set gravity or geometry?
Posted: 2016-08-23T08:58:20-07:00
by agriz
Code: Select all
convert -size 550x700 xc:none ( image.png -rotate -2 ) ( -clone 1 ) -layers merge output.png
how do i move the -clone 1 image to right side of the document?
instead of -layers merge how can i use composite and position the images using geometry or gravity? I have to include few more images and i have to rotate them.
Re: How to set gravity or geometry?
Posted: 2016-08-23T09:25:17-07:00
by fmw42
Work with images in pairs to use -gravity, -geometry and -composite. See
http://www.imagemagick.org/Usage/layers/#convert
Re: How to set gravity or geometry?
Posted: 2016-08-23T09:53:13-07:00
by agriz
Sir,what if I have to delete some of the images during the process?
Re: How to set gravity or geometry?
Posted: 2016-08-23T10:45:09-07:00
by fmw42
agriz wrote:Sir,what if I have to delete some of the images during the process?
I do not understand. Once you composite two images, they are automatically deleted leaving only the composite results. So you just composite the first two, then add a new image and composite that with the previous composite result and so on.
Re: How to set gravity or geometry?
Posted: 2016-08-24T00:41:43-07:00
by agriz
I dont have any coding to share. I am just collecting ideas.
Code: Select all
assusming image size is 400x400
convert -size 400x400 xc:none ( img.jpg -crop 100x100 ) ( -clone 1 ) ( -clone 2 ) ... -delete 1 output.jpg
I can position the clones using temp images in different convert command. i need to write multiple convert commands for that.
In the above example how can i position cropped images in different position. Here i can't write composite. Because i need to delete the img.jpg in the end.
Re: How to set gravity or geometry?
Posted: 2016-08-24T09:40:53-07:00
by fmw42
I do not understand what you are trying to do.
Your code does not show any composite. So you will get one output image for each input image.
If you want to change the order, then use -swap as I mentioned earlier. See
http://www.imagemagick.org/Usage/basics/#swap
Re: How to set gravity or geometry?
Posted: 2016-08-24T18:08:48-07:00
by agriz
Sir in the above code, how can i use composite before deleting the ( img.jpg -crop 100x100 )?
Re: How to set gravity or geometry?
Posted: 2016-08-24T19:01:39-07:00
by fmw42
agriz wrote:Sir in the above code, how can i use composite before deleting the ( img.jpg -crop 100x100 )?
First -delete1 will not remove ( img.jpg -crop 100x100 ), it will remove ( -clone 1 ). Image indices start at 0 not 1.
Second I am not sure what you are trying to composite. You cannot use -composite for more than two images at a time as I mentioned earlier. But you can flatten them all.
Why do you need the clones? ( img.jpg -crop 100x100 ) will make many smaller 100x100 images and will have automatically remove img.jpg. By cloning each one, you are making twice as many 100x100 subsections.
Have you tried
Code: Select all
convert -size 400x400 xc:none ( img.jpg -crop 100x100 ) -background none -flatten result.png
Does that do what you want?
Is img.jpg larger than 400x400? If so, you will be trying to put all the 100x100 pieces back over the 400x400 image in the places they were cropped and this will not fit the 400x400 transparent image.
Perhaps you should explain in more detail and show img.jpg so we can understand what it is you are trying to do.