Divisible by 4 For image sizes

Here is a list of numbers Divisible by 4

I made it up since its easier to just reference if you need more numbers just add 4 and continue.

4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,
104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,
180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,
256,260,264,268,272,276,280,284,288,292,296,300,304,308,312,316,320,324,328,
332,336,340,344,348,352,356,360,364,368,372,376,380,384,388,392,396,400,404,
408,412,416,420,424,428,432,436,440,448,452,456,460,464,468,472,476,480,484,
488,492,496,500,504,508,512.

if you use any if these sizes they will be divisible by 4 for retinal display.

I hope this is helpful as i didn't see a list online i decided to make one.

Comments

  • FallingBoxStudiosFallingBoxStudios Freelance Graphic Designer Member Posts: 822

    Bumping this even though it's old, extremely helpful when creating art for retina display :)

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2014

    useful, thanks, @radagar and cheers to @FallingBoxStudios for the bump.

    Couple of things to mention: first the list should carry on to 2048; second to say, just to point out the obvious which might not be for some new users: divide the chosen number by 2 to get the actual size shown in your game; finally, I'll point out the principal that iOS treats images within set sizes: 2x2, 4x4,8x8,16x16, 32x32,64x64,128x128, etc., doubling up till 2048x2048.

    The implication of that is iOS will allocate the same amount of RAM for a 72 x 128 image as a 128 x 128 image, as an example.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2014

    @gyroscope said:
    . . . iOS treats images within set sizes: 2x2, 4x4,8x8,16x16, 32x32,64x64,128x128, etc., doubling up till 2048x2048.

    Just to clarify, the X and Y dimensions are treated independently, so any combination of 2n numbers will work fine rather than only square numbers.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @Socks said:
    Just to clarify, the X and Y dimensions are treated independently, so any combination of 2n numbers will work fine rather than only square numbers.

    Useful to know, thanks.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • BelwasBelwas Member Posts: 22

    Just to clarify - So an image 64 x 128 won't use the same RAM as 128 x 128?

    And images need to be created using any of the dimensions @radagar listed (but doubled) but the ram will be what @gyroscope‌ listed?... So 284 x 476 will work but will use up 512 x 512 equivalent of RAM?

    Thanks guys, this has always confused me and I'm now creating the artwork so need to clear it up!

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @Belwas said:
    Just to clarify - So an image 64 x 128 won't use the same RAM as 128 x 128?

    Hi, that's right (answering for @Socks). (The 64x128 image will take up half as much RAM as the 128x128 image).

    @Belwas said:
    And images need to be created using any of the dimensions radagar listed (but doubled) but the ram will be what gyroscope‌ listed?... So 284 x 476 will work but will use up 512 x 512 equivalent of RAM?

    In this example, yes, as 284 is larger than 256, the next doubled amount being 512; the 476 dimension within the 257 to 512 range will also be treated as 512. (Hope I've explained that clearly enough).

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • BelwasBelwas Member Posts: 22

    @gyroscope said:
    In this example, yes, as 284 is larger than 256, the next doubled amount being 512; the 476 dimension within the 257 to 512 range will also be treated as 512. (Hope I've explained that clearly enough).

    Ah brilliant.

    Yes perfectly clear, it's finally sunk in! Thank you :smile:

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Belwas said:
    Just to clarify - So an image 64 x 128 won't use the same RAM as 128 x 128?

    What @gyroscope . . . .

    @Belwas said:
    And images need to be created using any of the dimensions radar listed . . .

    No, not at all, in fact I'd avoid a lot of the sizes listed for the reasons @gyroscope explained, for example in that list we have sizes like 260 pixels, just 4 pixels larger than 256, yet using a 260 pixel image instead of 256 pixel image will double your RAM usage, and place more strain on the target device's processor as it is having to throw around a 512 pixel image.

    Of course at the end of the day you can use whatever you like, there are no actual limitations (other than the upper limit of 2048), but there are sizes that are more efficient than others . . . . so if you have a game with 120 aliens chasing you though a shopping centre and they are all 65 x 65 pixels, you might be better off making them 64 x 64 pixels as this is only 25% of the size (in RAM) of the 65 x 64 pixel aliens (which, in RAM, are 128 x 128 pixels) . . . .

    Or in numbers of pixels . . (64x64x120 vs 65x65x120)

    491,520 vs 1,966,080 pixels.

    . . . on the other hand if you have a game with just 20 images that are not all on screen flying around at once then it really won't make much difference if the images are 1024 pixels wide or 1100, no one will notice the extra 0.0X of a second they take to load or the fact that the download size is 14MB rather than 11.8MB.

    Also the divisible by 2 or 4 thing is not set in stone either (and looking decidedly questionable in wake of the new x3/x2/x1 system about to appear), some things will benefit from being evenly divisible for sound technical reasons (a pixel that is forced to sit on a sub pixel position will be averaged between the two pixels, or smeared / blurred / aliased) . . . but if you stick a 119 x 173 image of an asteroid into your game and you preview it on your iPad (or whatever) and it looks great, then it is great ! :smile: And there is absolutely no reason the change it if you don't want to, your odd sized non-evenly divisible asteroid won't make your game slower or any less technically correct or place any additional strain on your processor, the concern is purely aesthetic.

    I have a few game elements that were thrown together in a rough build, that when I went to sort out by making their sizes evenly divisible, made them lose a little something, the edges where too hard, I preferred the slight aliasing they got by sitting on a sub-pixel position.

    . . . . and finally . . . :smile: . . . . the keep-sizes-within-a-power-of-2 recommendation is a separate issue to the make-image-sizes-evenly-divisible (which I think you already know, but for others who might not . . . ) one deals with memory usage, the other with image quality.

  • BelwasBelwas Member Posts: 22

    Awesome. Got it :)

    Thanks guys so much for elaborating, I'm sure many other newbies will find this thread invaluable too.

    One last query - The image size you want on gamesalad, this needs to be created at double the size so it still looks crisp on retina/newer devices?

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Belwas said:
    One last query - The image size you want on gamesalad, this needs to be created at double the size so it still looks crisp on retina/newer devices?

    Yes, as an example when you work on a project destined for a Retina iPad, you work in a 1024 x 768 pixel GameSalad project . . . whereas the actual Retina iPad screen resolution is QXGA (2048 x 1536 pixels) . . . . so if you have a 100 x 100 pixel actor zooming around the screen, the artwork for him needs (ideally) to be 200 x 200 pixels.

  • BelwasBelwas Member Posts: 22

    @Socks said:
    Yes, as an example when you work on a project destined for a Retina iPad, you work in a 1024 x 768 pixel GameSalad project . . . whereas the actual Retina iPad screen resolution is QXGA (2048 x 1536 pixels) . . . . so if you have a 100 x 100 pixel actor zooming around the screen, the artwork for him needs (ideally) to be 200 x 200 pixels.

    Ohhhhh.... So simple! Thank you

  • radagarradagar Member, PRO Posts: 47
    edited October 2014

    i am honestly really glad this was helpful to people. I know it helped me understand how reselution in images work in games. I will take some time to update the list and put in the other options. I am glad people use this and it has caused conversation. I havent looked at this in awhile:)

  • 3absh3absh Member Posts: 601

    @Socks said:

    @gyroscope said:
    . . . iOS treats images within set sizes: 2x2, 4x4,8x8,16x16, 32x32,64x64,128x128, etc., doubling up till 2048x2048.

    Just to clarify, the X and Y dimensions are treated independently, so any combination of 2n numbers will work fine rather than only square numbers.

    Does this apply to Android as well?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Not sure but it's worth noting that the rule for divisibility by 4 is to check the divisibility of the last 2 digits:

    16 --> divisible by 4? --> 16/4=4 --> yes!
    216 --> divisible by 4? --> 16/4=4 --> yes!
    2516 --> divisible by 4? --> 16/4=4 --> yes!
    739921824 --> divisible by 4? --> 24/4=6 --> yes!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.