ImageRectOffset and ImageRectSize aren’t quite working for me as expected.
I’ve tested both setting properties directly in Roblox Studio, and in script.
Both result in the same problem - showing more of my spritesheet than expected.
Each tile of my sprite sheet is 128px x 128px. IIRC the resolution is 72 pixel/cm.
The element is a ImageButton. It is a descendant of a UIGridLayout. (FYI tree is UIGridLayout > Frame > ImageButton)
As seen here;
You can see parts of the other tiles. The red border in the right hand image shows roughly where 128x128 is.
I’ve tried all ScaleTypes.
Any suggestions would be most appreciated. Thanks!
edit: in this pic ImageRectOffset is set to 0,0. Same problem occurs when it’s set to (128,128), etc.
2 Likes
This is because image resolutions in roblox can differ from the original upload. Find the id of the asset you are using and place it here:
https://roblox.com/asset/?id={ID}
It should download the image you just uploaded and you will be able to check its actual resolution in roblox.
If you want to do it the easy way, you can just guesstimate the size of the image and divide it by how many sprites there are to get the size of one sprite until it fits.
7 Likes
Wow, thank you. I had no idea assets were re-sized. I’d already shrunk my image to reduce file size. I wonder if I could use the original size as Roblox downsizes it anyway.
I also wonder why they don’t have a Scale offset. This would have saved me a shed load of problems. 10% offset is 10% offset regardless of resizing.
1 Like
Yea, I hate that too. At the very least they should show an editor with the image beside it. It really is silly how it is also based on the decal on roblox’s size too. A bunch of weird things but hey at least it works.
For anyone else reading this thread;
the link kindly provided by Wunder_Wulfe downloads an extension-less file. Add the .png file extension and you can then open it as a png.
My image was downsized from 1280 (10x128) to 1024 (10x124). 1024 is a multiple of 128. I’m not sure if this is coincidence.
With this new found knowledge I set my offset to (102.4, 102.4) [I didn’t bother rounding] and it now works!
Roblox resizes all images to powers of two i believe but I think their maximum is 1024.