Import and crop image

hi, How Can I Import an Image and crop it to a circle form in run time/build?

There are many ways to do this.

If it’s just for display in a UI then masking it would be the most common approach. Unity has a handy mask component for that.

If your really need a new image then copying only the pixels you need into a render texture is another.

A third way would be masking on a shader level.

It kinda depens on what your use-case is. Choose your weapon.

1 Like

Import from? Project? Network? File? Bittorrent? Webcam? Plenty of possible ways, plenty of tutorials for all those ways.

Crop how? All cropping interfaces I have seen are pretty hairy complex user interaction drag / squeeze / pinch affairs. Pick one you like and start working through implementing its features. You will implement them only one feature at a time, same way you put your shoes on, one foot at a time.

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, log output, variable values, and especially any errors you see
    - links to actual Unity3D documentation you used to cross-check your work (CRITICAL!!!)

The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

  • Do not TALK about code without posting it.
  • Do NOT post unformatted code.
  • Do NOT retype code. Use copy/paste properly using code tags.
  • Do NOT post screenshots of code.
  • Do NOT post photographs of code.
  • Do NOT attach entire scripts to your post.
  • ONLY post the relevant code, and then refer to it in your discussion.