- Home /
Crop UI image and convert it as Sprite
Hi!
On our game, we need to load an image from the Android gallery and crop it as an avatar. Loading the file is already done, and we use it as an UI Image, but then cropping it wasn't sucessful. We need to use UI for this because how our game works, also it works better with Rect objects, but we need to retrive pixel data from the Image and convert it to a new Sprite.
Thanks in advance.
Answer by IMemeManI · Jan 17, 2018 at 03:32 PM
Have you tried setting your canvas to "World Space", because then you can literally just plop the sprite in 3D space and have it still render.
Is the same thing, because it's still using the same UI properties, also we don't know how to retrieve data from the image.
To retrieve pixel data use a for loop to loop through the image texture.
Your answer
Follow this Question
Related Questions
Why is Sprite a null? 0 Answers
How to create Sprite programmatically 1 Answer
What is the best method to display different pictures? 0 Answers
How to get the already slice and scale-up properly sprite of a UI image at runtime? 0 Answers
Image sprite loaded from scriptable object ignores color 0 Answers