Image resizing in gamesalad

Hi,
I'm a little unsure with one aspect of the image resizing in GS
I understand that all images should be created so they are divisble by 2
However, say I create an image that is 128x128 and import it into gamesalad. I apply that image to an actor, yet the actor size is 70x70 for e.g.
Is this an efficient way to work and does this still use up the same amount of memory as the 128x128 image?
Does it matter that the actor isn't divisible by 2, but the image is?
Is it good practice to make the actor size the same as the image size?
Anyone got any advice on this?
Thanks
I'm a little unsure with one aspect of the image resizing in GS
I understand that all images should be created so they are divisble by 2
However, say I create an image that is 128x128 and import it into gamesalad. I apply that image to an actor, yet the actor size is 70x70 for e.g.
Is this an efficient way to work and does this still use up the same amount of memory as the 128x128 image?
Does it matter that the actor isn't divisible by 2, but the image is?
Is it good practice to make the actor size the same as the image size?
Anyone got any advice on this?
Thanks
Comments
2, 4, 8, 16 , 32, 64, 128, 256, 512, 1024
...it's an iOS memory thing. It's not efficient to use numbers that are not powers of 2, but the game will still run. (Although, GameSalad currently doesn't allow image width/height values larger than 1024 pixels... and I had a big problem with a 1x1 image.) It just gets chucked into an invisible box. a 25x50 image is treated as a 32x64 image. At that size the difference in memory is minimal, but at larger sizes, it can really waste memory.
Here's an example from The Unofficial GameSalad Textbook...
If you had a 513x513 sized image, it's treated like a 1024x1024 image. So the memory usage jumped from about 512 KB to 2 MB. That's a big difference.
In your example, you have a 70x70 image. Typically, I would try to squish that image to 64x64. It's more optimized.
If you're using retina display graphics, then the image inside the box is larger than the actor size. A 64x64 actor would have a 128x128 image. I usually try to keep the actor size the same size as the image... or properly adjusted for retina display. Otherwise, that's wasted memory. (Although, if you do oversize your graphics, they might look somewhat sharper when rotating. So, there are exceptions.)
So... in summary... I generally keep image sizes limited to "powers of two" and I align the actor size to match the image... unless I'm using retina display, where the width and height values are doubled.