Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
This indeed works, but it also "crops" the image (actually, it retains the original image size).
I would like to "grow" the canvas to fit the rotated image. Using +distort:
After a rotation with "+distort SRT" or "-rotate", a "+repage" may be useful to remove the virtual canvas data. This is automatically removed for output to jpeg, but not for png, and might be the reason for the OP's problem.
After a rotation with "+distort SRT" or "-rotate", a "+repage" may be useful to remove the virtual canvas data
This is probably a good idea. However, as a test, I tried my command above and it did not display any virtual canvas issues using png output. So I am wondering if there might be a virtual canvas already in the input image, which would also need to be removed by the +repage.
We would have to see the input image to know for sure. Can that be provided? You can post it to some free image hosting service such as dropbox and then put a link here. Also please supply your IM version and platform.
Last edited by fmw42 on 2013-10-03T21:11:58-07:00, edited 1 time in total.
However, I had no problem in displaying the resulting image and did not see any shifts. Could just be the browsers and my Mac Preview do not respect the virtual canvas or ignore negative offsets.
Turns out my problem had nothing to do with convert...
Users can rotate text on an image in their browser. I use CSS3 transforms for that (which rotates at the center).
Then I send the x,y coordinates of the text on the image, as well as the angle to the server.
On the server, the text is 'composed' over the image.
I simply forgot to recalculate the x,y position as a result of the new canvas size.
Now that this calculation is in place, the rotation works beautifully.
Thanks for all your replies!
Hey I am also facing the same issue. How you calculated the new x,y position? I also tried couple calculation but was not able to calculate proper x,y . It is still moving image location.
Can you please provide the logic to calculate new x,y position?
Thanks
av01d wrote:Turns out my problem had nothing to do with convert...
Users can rotate text on an image in their browser. I use CSS3 transforms for that (which rotates at the center).
Then I send the x,y coordinates of the text on the image, as well as the angle to the server.
On the server, the text is 'composed' over the image.
I simply forgot to recalculate the x,y position as a result of the new canvas size.
Now that this calculation is in place, the rotation works beautifully.
Thanks for all your replies!
What exactly is your problem and what is your IM version, platform and exact command line.
If your image has no virtual canvas, then -rotate or +distort SRT will not crop your image and you do not need to provide the center points. If you have a virtual canvas, then add +repage after reading in the input image to remove it.
It is also better etiquette to make a new post and not tack onto an old post that is likely solved and may not be your exact problem.
If you have rotated image and need the new center coordinates for some reason, then in Unix, you can compute a variable that has the new center coordinates