Does rotating change the size?

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?".
Post Reply
bobthebuilder
Posts: 5
Joined: 2011-01-29T16:41:23-07:00
Authentication code: 8675308

Does rotating change the size?

Post by bobthebuilder »

If I execute

Code: Select all

convert -rotate 90 bob.jpg ans.jpg
with an image that is x by y pixels I get an image that is y by x pixels, great, I've transformed landscape to portrait! But on viewing both images on my PC screen, the aspect ratio of the rotated image appears to have changed. :?

Is this a display issue, or has the design really been resized?

I have noticed a similar effect with imagerotate in GD/PHP, which does warn that the dimensions may change. Given that the images are the correct number of pixels in size, I can only conclude that a pixel is rectangular and not square.....

I suspect I am about to be embarrassed by your answers!

Thanks in advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Does rotating change the size?

Post by fmw42 »

H/V Aspect ratio should be inverted when you go from portrait to landscape. But I presume you mean that landscape H/V should be the same as portrait V/H. Rotation by other than 90 degree increments will enlarge the image dimensions.

What image dimensions are you getting before and after the rotation.


try

convert bob.jpg -rotate 90 ans.jpg

see syntax at http://www.imagemagick.org/Usage/basics/#cmdline


This may not make any difference.


Also what version of IM are you using?


Perhaps I misunderstand your question. Is this about the image pixels or the screen display of the image?
Last edited by fmw42 on 2011-02-04T10:57:11-07:00, edited 1 time in total.
SnowUse
Posts: 7
Joined: 2011-02-03T07:59:44-07:00
Authentication code: 8675308

Re: Does rotating change the size?

Post by SnowUse »

Without any specialist knowledge on the topic, I can only say what I see.

My two main screens both have a native resolution of 1680x1050 (1.6:1). Measuring them (by eye with a ruler, so this isn't exactly particle physics kind of accuracy) I get the following dimensions (to the nearest 0.5 mm or so): 435mmx272mm, which suggests a ratio of 1.599264706:1

Therefore I conclude that the pixels on my screen are so close to square as to make no difference.

Are you sure it's not a perspective thing? My third screen is a smaller 1280x1024. When I have it in portrait mode it looks almost square, but when I physically rotate it to portrait mode (great for log files!) I've actually had colleagues ask how I managed to obtain a third wide-screen monitor.

YMMV.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Does rotating change the size?

Post by fmw42 »

when we talk about image aspect ratio we are only talking about pixel dimension in the image. this has nothing to do with screen resolution or size in inches or centimeters or how the picture looks when displayed. the image may become distorted in screen aspect ratio depending upon how your have your screen calibrated and the screen aspect ratio.

If one is talking about screen pixel sizes, then most monitors have square pixels and but others may have rectangular ones, at least I think this used to be the case. But I am not an expert on this. So try googling on the subject.
Last edited by fmw42 on 2011-02-04T11:07:41-07:00, edited 1 time in total.
SnowUse
Posts: 7
Joined: 2011-02-03T07:59:44-07:00
Authentication code: 8675308

Re: Does rotating change the size?

Post by SnowUse »

with an image that is x by y pixels I get an image that is y by x pixels, great, I've transformed landscape to portrait! But on viewing both images on my PC screen, the aspect ratio of the rotated image appears to have changed. :?
Unless I have totally misunderstood OP, the image aspect ratio has been correctly inverted by the rotation.

He states that it has not changed, but says that it "appears to have changed", which is why either rectangular pixels or a eyes/brain/perspective issue are the two most likely culprits here...?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Does rotating change the size?

Post by fmw42 »

I think it is the issue of screen calibration and non-square screen pixels as image pixels are by definition square, but when displayed to the screen as measure in inches or centimeters, then the aspect ratio of the picture on the screen may not be the same as that of the image itself. Screen pixels in inches or centimeters may not be square. You have to divide the useable screen dimensions, by the specified screen resolution to get the size of each screen pixel.
bobthebuilder
Posts: 5
Joined: 2011-01-29T16:41:23-07:00
Authentication code: 8675308

Re: Does rotating change the size?

Post by bobthebuilder »

fmw42 wrote:I think it is the issue of screen calibration and non-square screen pixels as image pixels are by definition square, but when displayed to the screen as measure in inches or centimeters, then the aspect ratio of the picture on the screen may not be the same as that of the image itself. Screen pixels in inches or centimeters may not be square. You have to divide the useable screen dimensions, by the specified screen resolution to get the size of each screen pixel.
By jove, I think we've cracked it. As fmw42 says, its the relationship between the screen's phyical size and pixel set up that determine how square my pixels are. Now that I've measured them, my standard 4:3 images don't even measure 4:3 on the screen, so when rotated, the discrepancy appears even worse. Thanks for all your input, that's one less thing to worry about.
Post Reply