Is there a way to get the original image size?

I’ve found out that Unity modifies image sizes so that their width and height are in the power of two. I’m currently loading a bunch of images using “Resources.Load”, and if I after that get the mainTexture.height, it is the converted height.

Is it possible to somehow get the original image size through code? Eg. 218 instead of 256? I see some one has made an editor only solution for this, but are there more practical solutions? This would be needed in order to maintain the aspect ratio of images.

Try marking the texture as GUI in its import settings.
Here’s an example with a texture that was originally 800x600.
(Before: , After: )
Alternatively, set its type to Advanced and choose None for the non-power of 2 property. (