Trouble cropping an image using ImageRectOffset & ImageRectSize

Only just come across ImageRectOffset and ImageRectSize, and I have no idea how to use them in order to crop the top of a circle, like in the image below. How would I turn this circle into a semi-circle using Rect? The docs aren’t too helpful. Cheers

image

This probably would better fit in #help-and-feedback:art-design-support

It goes based on the size of your original image.

So suppose we have this 150x150 circle with a 25 pixel padding on each side (so our image now is 200x200)

When we import it we have our circle with the padding like so:
image

First thing we want to do is get rid of the padding which is where our ImageRectOffset comes in. We know we have a 25-pixel padding for each side, so our ImageRectOffset would be 25, 25 to account for the padding on the left and top.

So ultimately, the top-left corner of our “sprite” which is the circle, is located at 25, 25.

Now, we know our circle is 150 pixels wide and tall, so our ImageRectSize would be 150, 150. 1st 150 for width, 2nd 150 for height.

Another way to look at it is that the bottom right of our sprite is located at 25 (obtained from ImageRectOffset) + 150 (obtained from ImageRectSize), 25 + 150, or 175, 175

What we’re left with now is a circle without padding.

image

Now, to answer your question about how to turn it into a semicircle, since we know our circle is 150 pixels tall, we can now use ImageRectSize to crop it.

We know our circle is 150 pixels tall, so half of that, would be 75. So our new ImageRectSize for a semicircle would be 150, 75. 150 pixels for the width, 75 for the height.

What we’re left with now is a (stretched) semicircle.

image

Now, what if we want the lower half?

Simple, we leave ImageRectSize at 150, 75, and we go back to ImageRectOffset.

Because we know a semicircle would be 75 pixels tall, we just add 75 pixels to our ImageRectOffset.

So our new ImageRectOffset is 25, 100

Again, we’re left with a stretched semicircle, this time the bottom half of it.

image

1 Like

Thank you so much. However, is there any way to leave the space that was cropped empty, instead of stretching to fill it? Would that be SliceType?