When I load images from files, at times the width and height properties are swapped. This effect seems to happen with “larger” images such as 3000 X 4000 pixels.
Here are some screenshots which show the image directly from the file and its width and height:
A large 3000 X 4000 image
Properties of large image
A smaller 720 X 1280 image
Properties of smaller image
Here are two screenshots from the designer showing the rendered images. Please note how the larger file´s width and height were swapped.
In this image the width and height were swapped:
No issue with this image:
Below is the code:
#Find Aspect Ratio of Original Image filename = imgComponent.getPath() img = ImageLoader.getInstance().loadImageNoCache(filename, None) #this line causes the JVM heap error in the client or designer imgW = img.getWidth() imgH = img.getHeight() print "Width = ", imgW print "Height = ", imgH imgRatio = float(imgW) / float(imgH)