Im trying to cut an image in half

Im trying to cut an image in half and place each half on the left and right of the screen to make it look like its one image

Here the code i tried, and the result :

        local screensize = workspace.CurrentCamera.ViewportSize
	
	Screen.Left.Image = screenshot
	Screen.Right.Image = screenshot
	
	Screen.Left.ImageRectSize = Vector2.new(screensize.X/2,screensize.Y)
	Screen.Right.ImageRectSize = Vector2.new(screensize.X/2,screensize.Y)
	
	Screen.Left.ImageRectOffset = Screen.Left.ImageRectSize * Vector2.new(0,0)
	Screen.Right.ImageRectOffset = Screen.Right.ImageRectSize * Vector2.new(1,0)

What it look like :

What i want it to look like :

My ScreenGui look like this :
image

Both of the image labels are put on the half left and half right of the screen respectively

Please help me, if you have any question just ask, i tried to be clear :folded_hands:

1 Like

If you managed to make the image show up as how you wanted what’s the problem exactly?

3 Likes

my script is taking a screenshot of this image and trying to replace it corectly while cutting it in half ( i want to use it for a cool transition animation )

1 Like

I ran a quick test using what you sent and the script snippet seems to be fine. Are you using CaptureService to take a screenshot inside the game or is this a pre-determined image? If the resolution of the image doesn’t match the screen that could be an issue.

1 Like

Just move each side to it’s final destination equally then Tween to that position to make it smooth, after your done rearrange them to starting position.

If you don’t understand dm me on discord I’ll explain: imnotspider

1 Like

On closer inspection, my bad, I see what you mean now.
CaptureService can capture(?) and display images at a different resolution than the screen, which breaks the math. And I don’t think there is a way to get the resolution of a temporary image, so the simplest and most likely the best fix is to ignore RectSize and RectOffset entirely and use 2 frames with ClipsDescendants to split the image instead.

So the hierarchy would be like:

1 Like

im using captureservice, i will try to find what the resolution of roblox capture are, i will also try the clip descendants method, even if it was not really what i was looking for ( i might do a request to roblox for the capture service if thats the case )

1 Like

do you know anyway i could fix this for phone players ? the roblox UI screen is not the full phone screen smh

( your solution works for PC and does this on phone )

you need to scale it using autoscale lite

auto scale is not made for this … it doesnt work

why not? uiaspectratioconstraint is used mainly on frames

Try
ClipToDeviceSafeArea
SafeAreaCompatibility
ScreenInsets

There’s a method to get the size of a temporary screenshot but it’s restricted. If you have access to EditableImage, you can load the screenshot as one and get the Size.

I think @Cliosow’s solution is simpler and more accessible than dealing with pixel sizes.

1 Like

HELLOROBBEROX8 has it, but you don’t need auto scale. Just do what that is doing yourself. You have two parts for each setting: scale and offset. In this case, you’re just looking for a full screen, so it would be (1, 0, 1, 0) : 100% width with 100% height. Using scale only will work on any screen.

At this point would you mind sharing the Image so I can recreate what I think you want? It’s taking too long

Switching the ScreenInsets in the ScreenGui to None should fix it.

i think thats the thing i was looking for im going to try it later

it works ty, i didnt know about ScreenInsets i will look into it


makes an ugly white line on the bottom but i will find a way to hide it !

( turn out these white lines are only visible in studio )

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.