I need an image to be cropped and flipped. I do this using a negative ImageRectSize.
It’s hard to explain but this is the basic logic to it:
An image has a pixel size and offset:
ImageRectSize(X1, Y1) and ImageRectOffset(X2, Y2)
when I need to flip it, I use it like this:
ImageRectSize(-X1, Y1) and ImageRectOffset(X2+X1, Y2)
The Image label uses Enum.ScaleType.Fit so that the image retains it’s aspect ratio. However, here lies the problem. When the image is flipped, the ImageLabel crops it in order to fit the image on the Y axis, rather than the X axis. This causes the images to be cropped instead of fitted, like this:
Here is the code I use to load a sprite onto an ImageLabel, “sprite” is a table with all of the sprite sizes and offsets: {imageid, sizeX, sizeY, offsetX, offsetY}
Label.Image = 'rbxassetid://'..sprite[1]
Label.ImageRectOffset = Vector2.new(sprite[2] + (reverse and sprite[4] or 0), sprite[3])
Label.ImageRectSize = Vector2.new(reverse and -sprite[4] or sprite[4], sprite[5])
Label.ResampleMode = Enum.ResamplerMode.Pixelated
Label.ScaleType = Enum.ScaleType.Fit
I need a way to have the image Fit on the X axis rather than the Y axis. Sorry if this is badly explained, and thanks in advance!