Show only the right most part of the loaded image

Hi. I need to load an image but only show the right most part in the texture. SO far, the code just loads the image to the texture causing the preview to show the compressed version of the image rather than just the right most part.

	RawImage ImagePreview;
    ImagePreview.enabled = true;
    string url = _SavePath + z.ToString() + ".png";
	byte [] imageprev = File.ReadAllBytes(url);
	texture = new Texture2D(camTexture.width, camTexture.height, TextureFormat.ARGB32, false);
	texture.LoadImage(imageprev);
	texture.ReadPixels(new Rect (520, 0, 70, texture.height), 0, 0);
	texture.Apply();
	ImagePreview.texture = texture ;

I don’t think RawImage of Texture2D have anything to show just a part of the texture. You can try some of this:

1 - Write some custom component with a different UV mapping than the RawImage (instead of 0,1 in both axis, something like 0,0.5 for x and 0,1 por y)

2 - Maybe you can get the mesh used by RawImage and see if you can change the UV of the vertices.

3 - Create a new Texture that’s just the part you want to show from your renderer texture.

4 - Use a mask to hide some part of the RawImage

Child the ‘texture’ object in an object with a Mask Component (2d for UI, regular for World) then change the size of the Mask object as/after/before you apply the texture change.