Your images divisible by 4
ryast
Member Posts: 145
I'm no math wiz, and i actually had all the sizes written down so i could refer to them and make sure my images were divisible by 4... That was a pretty long list!
If you are like me, here's a little tip for you (that i just learned) ; no matter how big the number, just look at the two last digits and if they can be divisible/multiplied by 4... you are good.
Eg:
56789 - here just look at the "89"
234323 - here just look at the "23" (at the end, not the beginning)
can also be used with ridiculous numbers like 23423523524453523544 (all you need to look at is the 44 at the end)
Cheers!
Comments
I like it, that's a cool little trick. Thanks for sharing
Though I think I'd be facing bigger problems than mathematical ones if my images are getting into the tens of thousands lol.
Haha! Most welcome!
I wish I could contribute more here like @BBEnk / thunderchild etc do, but since I am not as good as them in GS I'll leave that to the experts
This has saved me time in referring my long "chart" of numbers, now I can do the multiplication in my head without leaving Photoshop, hopefully it will help others as well!
(Thanks for hitting the like button, one day those things are going to be worth good money, I just know it!!!)
What I always do is divide by 4 and then look for the closest integer and multiply by 4 but your trick looks easier
Lump Apps and My Assets
They are different in that your method generates a number that is divisible by four, his method just checks whether a number is divisible by four.
I make all my images 4 pixels by 4 pixels, never had any trouble so far
P.S . . . . The 'must make stuff divisible by 4 or you will die is a massive fireball' recommendation is useful (a good guide), but not really essential, even if you have an image that is not divisible by 4 you can simply place it appropriately for its dimensions instead of resizing it.
So if you had a 101 x 101 pixel image, the slight blurring/aliasing you are trying to avoid by making the image divisible by 4 is only an issue if the image is sat on whole pixel values (e.g. x=220 y=400 . . . rather than . . . x=220.43 y=400.97), so all you'd have to do to get rid of the slight blurring/aliasing is to make sure the oddly dimensioned image is sat on a half pixel value (e.g. x=300.5 y=85.5).
40 x 40 pixel image located at x=100 y=100 . . . . no issue
40 x 40 pixel image located at x=100.53 y=100.29 . . . . slight blurring/aliasing
41 x 41 pixel image located at x=100 y=100 . . . . slight blurring/aliasing
41 x 41 pixel image located at x=100.5 y=100.5 . . . . no issue
That is the say the recommendation to make images divisible by 4 (or 2) is dealing with the very same issue that is dealt with by the recommendation to place images on whole pixel values . . . but I expect a lot of newcomers have the 'divisible-by-4' mantra drilled into them but are unaware that unless they place their divisible by 4 images on a whole pixel value they are wasting their time making their image assets divisible by 4.
Furthermore, if someone opens their oddly dimensioned image into Photoshop and resizes it - even using the very best available algorithm - the interpolation or extrapolation process will introduce at least as much blurring/aliasing as you get from the image being oddly dimensioned (to avoid this ensure the dimensions are divisible by 4 when you generate the image or if you are editing after-the-fact then simply cropping off the extra pixels without resizing [or enlarging the canvas area without resizing] will also avoid introducing any slight aliasing/blurring).
And . . . seeing as the overwhelming majority of games involve moving elements, the recommendation to make images dividable by 4 is pretty much redundant as the pixels will be constantly shifting between sub-pixel positions.
You don't have to necessarily be an expert in GS. There are different areas in which you can have knowledge in that others don't. This forums work as collective knowledge put together as a whole to help better the community. Sharing any knowledge helps greatly.
Fortuna Infortuna Forti Una
reductionist like you, and to stay on the safe side, I make my images 1x1px and build the whole scene with a single particle spawner. Super simple, though the results are a bit touch and go.
For beginners, I like them to stick to the sacerdotal "divisible by 4 and placed on whole pixels else massive fireball" until they can ascend to fractions. >:)
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Socks Al true but having (creating) images dividable by 4 to start with makes it safer to work with.
I never enlarge in Photoshop either. Reducing in size sometimes depending on the image. Adding some extra pixels is indeed a better way. (enlarging the canvas).
I mostly work in Illustrator and make slices on a grid (with a grid size dividable by 4 indeed) or render out from Blender using sizes dividable by 4.
Lump Apps and My Assets
1x1 is the way to go, Apple cannot introduce an asset scaling system that will ever defeat the mighty 1x1 pixel approach !
But . . . seeing as the overwhelming majority of games involved moving elements, the recommendation to make images dividable by 4 is pretty much redundant as the pixels will be constantly shifting between sub-pixel positions.
In the vast majority of cases the recommendation is redundant, in fact it's easier to say when the recommendation is valid - and that would be static images that are sat on whole pixel values.
How is it safer ? Do you mean safe from the fireball ?
Seriously, I'm not sure what you mean by 'safer' ?
Yep, all* resizing will reduce image fidelity, enlarging tends to be worse, like you say depending on the image.
(* except NN interpolation/extrapolation to a pixel dimension divisible by the original)
You can do this in GameSalad too . . .
(this video was for another question, so it doesn't quite show you what I mean, as you would want to reduce the actor size by numbers (not dragging the handles), but it should give you the idea, what you are doing is essentially moving the image by a sub pixel value).
Yep, same here, I render/generate my images at power-of-two sizes where possible - e.g. 64 x 128.
Safer (not saver, excuse my English ) because I tend to get confused when I have to work with to much data
Lump Apps and My Assets
My Dutch is waaaaaaaaaaay worse than your English !
I suppose what I am saying is . . . . .
A 101 x 101 pixel image is fine, it will not blur if it is positioned appropriately, there is no real need to resize/crop it to a divisible by 4 pixel value, you could just place it on the appropriate sub pixel location (e.g x=240.5, y=173.5).
Yes, I understood but I would forget where what size goes. I would put the 100x100 on 240.5 etc and the 101x101 on the 240 etc. after a while if that makes sence. Just the way my brain works (or refuses to work).
Say something in Dutch now
Lump Apps and My Assets
If you notice that an image is slightly blurred, then move the actor by 0.5 pixel, if you don't notice then there is no issue (divisible-4 is after-all an aesthetic thing rather than a technical thing).
Ik zeker niet dit te doen met Google vertalen.
I just draw and let other people sort out the maths.
Just a simple Ogre with a simple outlook on things.
Ni allaf siarad Iseldireg naill ai fy ffrindiau.