While working on GUI, I realized that roblox doesn’t have a “fit” ScaleType for Images. This would be a great addition to add to prevent weirdly stretched images. Of course, it’s possible to do it yourself, but it requires another gui object and a lot of settings changed for the image object, and I think you might need a script.
Here’s a personal use case:
Currently working on one of these inventory systems for fun. If you look at the bottom two objects, you’ll notice how one is stretched and the other isn’t. While the original money bag was 3x3 (which looked okay,) I decided the money bag might need to take more space (for prototyping purposes.) When I increased the 3x3 to 3x4, it became stretched. I immediately checked to see if there was a fit ScaleType setting, but there wasn’t.
Currently, we can only stretch. If we could set the ScaleType to “fit,” it would look like the one on the right.
EDIT: It was brought to my attention that you can use “UIAspectRatioConstraint,” but you’ll still need two objects. (One for the frame back, then the image with the constraint inside the image.) You’d also would have to know the aspect ratio of the image, which I don’t think you can get without knowing the size outside of roblox (check me on that.)
Thanks a ton! I was actually going to make a suggestion for this a few hours ago and then I saw this. (I didn’t actually see them until after this cause I assumed they weren’t there lol)