> For the complete documentation index, see [llms.txt](https://handtracking.lightbuzz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://handtracking.lightbuzz.com/ui-reference/imageview.md).

# ImageView

```csharp
public class ImageView : MonoBehaviour
```

Inherits [UnityEngine.MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) class.

### Constructors

| Name        | Description                     |
| ----------- | ------------------------------- |
| ImageView() | Creates a new ImageView object. |

### Properties

| Name             | Type                                                                             | Description                     |
| ---------------- | -------------------------------------------------------------------------------- | ------------------------------- |
| Texture          | [UnityEngine.Texture2D](https://docs.unity3d.com/ScriptReference/Texture2D.html) | Read-Only. The image texture.   |
| Width            | int                                                                              | Read-Only. The texture width.   |
| Height           | int                                                                              | Read-Only. The texture height.  |
| FlipVertically   | bool                                                                             | Flips the texture vertically.   |
| FlipHorizontally | bool                                                                             | Flips the texture horizontally. |

### Methods

<table><thead><tr><th width="264">Name</th><th>Return Type</th><th>Description</th></tr></thead><tbody><tr><td>Load(<a href="https://docs.unity3d.com/ScriptReference/Texture2D.html">UnityEngine.Texture2D</a>)</td><td>void</td><td>Draws the texture for the specified Texture2D.</td></tr><tr><td>Load(StreamSource)</td><td>void</td><td>Draws the texture for the specified stream source.</td></tr><tr><td>Load(<a href="https://docs.unity3d.com/ScriptReference/Color32.html">UnityEngine.Color32</a>[], int, int, int)</td><td>void</td><td>Draws the texture for the specified color array, width, height and rotation.</td></tr><tr><td>Load(byte[], int, int, int)</td><td>void</td><td>Draws the texture for the specified byte array, width, height and rotation.</td></tr><tr><td>GetPosition(<a href="https://docs.unity3d.com/ScriptReference/Vector2.html">UnityEngine.Vector2</a>)</td><td><a href="https://docs.unity3d.com/ScriptReference/Vector2.html">UnityEngine.Vector2</a></td><td>Calculates the position in the local space of the image for the specified original 2D position of a point.</td></tr></tbody></table>

### Example

The example shows how to draw the texture with the `ImageView` class.

#### Draw the image texture

First,  add a [WebcamSource](/ui-reference/streamsource/webcamsource.md) field to get frames from a live feed and an `ImageView`field to draw the texture for Unity to serialize.&#x20;

```csharp
[SerializeField] private ImageView _image;
[SerializeField] private WebcamSource _webcam;
```

The easiest way to draw the image texture is by providing directly a [WebcamSource](/ui-reference/streamsource/webcamsource.md) object.

```csharp
_image.Load(_webcam);
```

Alternatively, you can provide the color array of the texture.

```csharp
_image.Load(_webcam.Pixels, _webcam.Width, _webcam.Height);
```

#### Get the local position of a finger joint

The `FingerJoint` class returns the joint's 2D position in pixels relative to the camera's dimensions. To represent this position on an `ImageView` texture, which may vary in size, the `GetPosition` method scales the joint's coordinates to match the texture's current width and height.&#x20;

```csharp
// Get the finger joint from the detected hand.
FingerJoint pinkyDip = hand.FingerJoints[FingerJointType.PinkyDIP];

// Get the original 2D position (pixels in the camera frame).
Vector2 original_position = pinkyDip.Position2D;

// Get the local 2D position (pixels in the ImageView texture).
Vector2 local_position = image.GetPosition(original_position);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://handtracking.lightbuzz.com/ui-reference/imageview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
