Get Image Actual Resolution

As a Roblox developer, it is currently too hard (or impossible) to get an image’s actual resolution. This means that allowing users to select their own decal/images to display risks making them stretched out if the UIs’ X to Y ratio don’t match the images’.

Having the image resolution/ratio would allow developers to be able to make it so custom user decals would work better in game.

69 Likes

I’d like this as a read-only property.
I always forget what resolution I upload my images at, and properties like SliceCenter and ImageRectSize/Offset rely on that information.

16 Likes

Support, but as quite a low priority feature to add. The thing is you can just open up your documents and get the resolution there. My friend PumpedRobloxian always sends me the pictures along with pictures of their dimensions.

Ergo…

8 Likes

You can’t open up your documents for other user images they want to display in your game on the go…

E.g: you have a house decorating system and allow users to use their own images for paintings. How can you make sure it’s not going to be stretched out without the image resolution/aspect ratio?

12 Likes

Oh right I see, yes I guess that is a problem. I still think it’s fairly low issue though

5 Likes

Well all the little things do add up.

And as @B_rcode pointed out,

So it would barely take any time for roblox to implement this feature - probably like 5 minutes (lol) - because they already have the data, all they need to do is create a read-only property to match.

7 Likes

It’s a perfectly reasonable thing to ask for, and yes we do of course have this information available. It could potentially affect multiple unrelated components though, like ImageLabel, ImageButton, Decal, Texture, MeshPart, etc. Anywhere a bitmap image is used as a source or texture. So maybe 6 minutes… (lol)

15 Likes

Does this mean it will be added? O.O

4 Likes

It will certainly be considered, but I was joking about the 6 minutes of course. While the numbers exist in memory, that’s not half the battle; it rarely is. Bitmap resources aren’t part of the Instance hierarchy, so it’s not a simple task of showing some properties, like it is for the absolute size of UI components. There is already the infrastructure to show properties of these objects that are reflected from C++ to Lua, which is why it’s easier to expose additional ones. It would be a considerably more work for the studio team to add an inspector for the properties of runtime-loaded assets (images, meshes, etc). Getting those numbers from C++ to Lua in a non-hacky way that supports other related requests (e.g. people have asked for triangle counts of meshes), thereby making it worth the effort, is something that has to be discussed and prioritized.

22 Likes

Any chance of this happening anytime soon?

14 Likes

I think this could become handy, the engineers could make it so automaticSize put the actual image dimensions.

Mix that with UIScale and you can resize it however you please

4 Likes

Bump, there’s already a property called ContentImageSize but it’s behind the RobloxScriptSecurity level, making it only accessible by corescripts
It would be neat to make the variable available to developers, i don’t see why it could be an issue.

11 Likes

100%. This is an essential feature that should’ve been available to us a long time ago.

1 Like

It certainly sounds less straight-forward than many people, including myself, initially considered. I hope you’re still considering it though, since I’m working on a script for PlayerGUI’s that lets me feed a function an array of images or a spritesheet, and some initialized values to essentially create particleEmitters and flipbooks for UI. The former input method works flawlessly, but the spritesheets depend on ImageRectSize and ImageRectOffset which takes the image’s resolution rather than the read-only AbsoluteSize or any other accessible values. I’ve been grasping at straws here looking for a way to find a way to automatically return the resolution of a decal but it’s been hopeless, so I’ve resorted to manually retrieving the resolution of decals which has had a negative impact on our workflow. By the time anything like this becomes accessible I’ll likely move on from this problem, but I still hope this feature gets added sooner than later.

Update: Ever since EditableImage has been created, now you can access the image resolution via EditableImage.Size, assuming you load your images via AssetService:CreateEditableImageAsync("assetid")
Currently only available in studio, as this is still in beta.

7 Likes

Bump. Sucks knowing that this may be another essential feature that will take forever to add. :frowning:

2 Likes

Another bump! Hoping this will be added soon! :heart:

2 Likes

Unfortunately this isn’t really possible for images that you don’t own now with the recent changes to permissions, which is a bummer since I have a plugin that uses EditableImages to quickly get an asset’s information.

1 Like