Page 1 of 1
rotating an image about bottom left corner
Posted: 2019-04-02T06:17:47-07:00
by manit
Hi , I am trying the following transformation
https://ibb.co/qBTvW7S
h t t p s : / / i b b . c o / q B T v W 7 S
https://ibb.co/qBTvW7S
Here image is rotated by angle theta in anti-clockwise direction .
My image magick supports following
Code: Select all
$ convert -list distort
Affine
AffineProjection
ScaleRotateTranslate
SRT
Perspective
PerspectiveProjection
BilinearForward
BilinearReverse
Polynomial
Arc
Polar
DePolar
Barrel
BarrelInverse
Shepards
Resize
What should be my command ?
Thanks .
Re: rotating an image about bottom right corner
Posted: 2019-04-02T06:39:55-07:00
by snibgo
What version of IM? On what platform?
You say "rotating an image about bottom right corner" but your sketch shows rotation about the bottom-left corner. The sketch doesn't say where you want the boundaries of the output. This could be the (a) same dimensions as the input, or (b) just enough to show the complete input, or something else. What do you want in the virtual-pixel areas? I'll assume you want blue pixels. I'll show a rotation of -30 degrees.
The bottom-left coordinate is 0,%[fx:h-1].
(a) is:
Code: Select all
magick in.png -background Blue -virtual-pixel Background -distort SRT 0,%[fx:h-1],1,-30 out.png
(b) is the same but with "+distort", and you might (or might not) want "+repage":
Code: Select all
magick in.png -background Blue -virtual-pixel Background +distort SRT 0,%[fx:h-1],1,-30 +repage out.png
Re: rotating an image about bottom right corner
Posted: 2019-04-06T07:24:48-07:00
by manit
I am using
$ convert --version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
on 64 bit ubuntu OS.
Sorry , I meant bottom left corner as picture shows.(corrected it in original post)
https://ibb.co/K0jKCFv shows that original image was shaded region of first quadrant and after rotation about bottom left corner I want image to look as it appears in that brown rectangle.
It means that after rotation , dimension of image increases .
Extra space should be filled by white pixel.
Re: rotating an image about bottom left corner
Posted: 2019-04-06T07:52:07-07:00
by snibgo
Okay, so that is easy:
Code: Select all
convert in.png -rotate -30 out.png
Does that do what you want? If not, what is wrong with it?
Re: rotating an image about bottom left corner
Posted: 2019-04-07T12:07:49-07:00
by manit
Consider this
convert logo: -fill none -stroke black -strokewidth 3 -draw "rectangle 10,10 630,470" logo_rect.png
convert logo_rect.png -rotate -30 rotated-by-minus-30.png
This rotates image (by 30 degrees in anti clockwise direction) about its center not bottom left corner.
Thanks.
Re: rotating an image about bottom left corner
Posted: 2019-04-07T12:20:17-07:00
by fmw42
What is the difference between rotating about the bottom left corner or the center. The only difference would be the amount of image cropped off. Try
Code: Select all
convert in.png -background Blue -virtual-pixel Background -distort SRT 0,%[fx:h-1],1,-30 out.png
or
Code: Select all
convert in.png -background Blue -virtual-pixel Background +distort SRT 0,%[fx:h-1],1,-30 out.png
The latter is the same as rotating about the center
Code: Select all
convert in.png -background Blue -rotate -30 output.png
Re: rotating an image about bottom left corner
Posted: 2019-04-21T00:14:28-07:00
by manit
yes , I think rotating the image with respect to bottom left corner gives result identical to that when image is rotated about its center.
This thread is solved.