When working in Studio, sometimes it is useful to know the actual resolution of an image you’re dealing with. This can come in handy for using the slice feature for a 9-slice or a spritesheet, making an image be the pixel-perfect size to prevent resize artifacts, or wanting to maintain the correct aspect ratio when resizing. This has been suggested a couple times, so I thought I’d spend a few hours making a plugin that does this, for the greater good!
Here is a video demonstrating how the plugin works:
https://gfycat.com/CrispOrneryAmericanriverotter
The plugin has the following options when you select something with an Image/Texture/Graphic/other image property:
- Get image size: Displays the image dimensions and prints them into the output
- Set size to image size: This will set the “Size” property of whatever you’re selecting (or the parent of your selection if you are selecting a decal or texture) to the actual proper resolution of the image. This is great for pixel-perfect icons in GUIs. Also great if you want giant parts with pictures on them.
- Set size, maintain width - Sets the height to whatever would be proportional relative to the image’s aspect ratio, keeping the width the same. Great for parts with decals or when you want to size-up an icon in one axis, then just click this button to automatically size up the other one correctly.
- Set size, maintain height - Same as above, but changes the width.
It also supports objects with more than one image property, like a ScrollingFrame.
The plugin also has another feature: when you insert a Decal from the Toolbox into an ImageButton or ImageLabel, it will take the Texture from the Decal and set that as the Image for the ImageButton/Label and deletes the decal. This is just a quality-of-life feature so you can easily set your GUI images without needing to copy/paste from decals. This feature can be disabled.
Install the plugin
This plugin uses a web API to get the dimensions, so HTTP requests must be enabled in your place. The web server script is also open source on GitHub. It pulls from Animinus’ Web API for property information so it should always work, even if Roblox adds more objects with image properties. While it’s not possible to distinguish Image content from other content (sounds, meshes, linked scripts), the plugin is hard coded to ignore all scripts, Sounds, KeyframeSequences, and Animations, and the property name “MeshId”.
The plugin is currently always enabled, so the menu will appear whenever you select an image object. I made this decision so it would be easier to use and so that you don’t have to deactivate other plugins when using them to build/edit. The menu is draggable, however. The plugin toolbar button will only appear if you need to press it to try again if HTTP requests weren’t enabled when the game started.
I hope at least someone finds this useful. Suggestions welcome, if you do.