9Slice - one corner larger + scaling help

GUIs are the bane of my existence. So, I’ve got this image:

Image

As you can see, the top-right corner is bigger than all of the other corner, and I’m wondering how I’d make this work with 9Slice, or if that’s even possible. More importantly, I thought 9Slice meant that borders wouldn’t scale to be thinner or thicker. This is my attempt, and it’s done… just that. What am I doing wrong?

The small frame on the left’s SliceCenter is 75, 950, 75, 960
The frame on the right’s SliceCenter is 61, 241, 750, 900

(in-game)

When the large frame is made smaller, the borders shrink too.

5 Likes

You will need to set the SliceCenter.X0 and SliceCenter.Y0 to be the coordinates of A and the SliceCenter.X1 and SliceCenter.Y1 to be the coordinates of B:

image

That is pretty much the most optimal corners you can set for this specific picture. Keep in mind though that your picture is huge, which is a problem when working with 9-slice. This is because the corners don’t change size, but the edges and the inner square do:

image

The blue area can stretch both horizontally and vertically, whereas the purple areas can stretch only horizontally or vertically. The corners can’t stretch at all.

So what does this mean?

Well, if your ImageLabel has a size that’s smaller than your picture, your picture needs to be squished down, so the purple and blue areas become smaller. However, there’s a catch to this squishing. Let’s take the following picture as an example:

image

Let’s assume that your corners in this picture are 150x150 pixels and the picture itself is 600x600 pixels. The smallest possible slice you could make with this is just the corners, so a picture of 300x300:

image

But now what if we use this image, but our ImageLabel has a size of 100x100 pixels? In that case your image is downscaled for the remaining pixels instead of down-stretched, meaning your corners and edges are becoming smaller:

image

This is why in your example your borders are shrinking in size: it’s because your image is too big (or at least, your corners are)

7 Likes

Thank you so much! This is really helpful, kind of realised it was because it was too big when I was messing with it but this helps a lot. Thanks!!

o geez this is a good post. I opened up photoshop to show the 9slice layout, but you got it done better than I did, anyway. :slight_smile:

To add to this, your image is 500x500. When you upload it to roblox, it will not upsize to 1024x1024, so your slice center should be in the range [0, 500]. I think when I was in photoshop, I saw (30, 125), (470, 375) was a good choice.

Edit: never mind. I got lost somewhere. When I tried to download the image, it was 500x500, but it looks 1024x1024?

1 Like

The size limit is now 1024x1024 if I recall correctly. It used to be smaller (512x512 or something) but it was changed a few years ago to be larger.

3 Likes

Yeah, I thought he was uploading a 500x500 image, though. It might have just been discourse playing tricks on me.

1 Like

ignore this, got it!