Is there an option for returning the texture as square cropped from middle? #50
-
Cropped area needs to be square as I said and if photo is portrait, crop square size should be photo(width)x photo(width) Also thanks for the great work, I really liked your pluggin. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I came up with a solution. I used one of @mops project script. It's link is; `private static Texture2D CropTexture(Texture2D texture)
I hope that helps if anyone is looking for this. |
Beta Was this translation helpful? Give feedback.
I came up with a solution. I used one of @mops project script. It's link is;
https://github.com/mopsicus/unity-crop-scale-texture/blob/master/Assets/Scripts/CropScale.cs
I editted that a little bit and here is the result.
`private static Texture2D CropTexture(Texture2D texture)
{
int cropSize;
if (texture.height > texture.width)
cropSize = texture.width;
else
cropSize = texture.height;
Rect sizes = new Rect();
Texture2D result = new Texture2D(cropSize, cropSize);