Wierd Screen Shot Problem, texture of screen shot looks different in editor and in system.

Hello, I have run into a very strange problem. I am taking screenshot of certain area of the screen using the following code.

IEnumerator Save()
{
camera.enabled = true;
//camera.targetTexture = new RenderTexture(512,512,24,RenderTextureFormat.ARGB32,RenderTextureReadWrite.sRGB);

	originalSide = Manager._instance.side;
	
	Manager._instance.side = 1;
	_shirtHandler.LoadPattern();
	
	//camera.Render();
	//yield return new WaitForEndOfFrame();
	RenderTexture.active = camera.targetTexture;
	Texture2D texFront = new Texture2D(camera.targetTexture.width,camera.targetTexture.height,TextureFormat.ARGB32,false );
	texFront.ReadPixels(new Rect(0,0,512,512), 0, 0);
	texFront.Apply();
	
	yield return null;
	Manager._instance.side = 1;
	_shirtHandler.LoadPattern();
	
	//camera.Render();
	//yield return new WaitForEndOfFrame();
	RenderTexture.active = camera.targetTexture;
	Texture2D texBack = new Texture2D(camera.targetTexture.width,camera.targetTexture.height,TextureFormat.ARGB32,false );

	texBack.ReadPixels(new Rect(0,0,512,512), 0, 0);
	texBack.Apply();
	Manager._instance.isSaving = false;
	
	//temp.material.mainTexture = texFront;
	camera.enabled=false;
	yield return null;
	//upload it to server..
	byte[] bytesFront= texFront.EncodeToPNG();
	File.WriteAllBytes("C:/Users/Vijay/Desktop/Front.png", bytesFront );
	File.WriteAllBytes("C:/Users/Vijay/Desktop/Back.png", texBack.EncodeToPNG());
	
	Manager._instance.side = originalSide;
	_shirtHandler.LoadPattern();
}

There are two cameras in game. one is the main camera and another one is only for the purpose of saving the screen shot of certain area of screen. I am enabling the camera at the time of capturing alone. I am getting the screenshot as per my requirement but only until i save it to local… when I apply the captured screenshot to a material in game it is working fine but whn i save the screen shot, I could hardly see the colors in there. and when i import the saved screen shot into unity, it is looking normal. But every where else except unity im seeing an image without much colors…I am attaching both the versions in this mail…

The saved screenshot

The above might look like empty image but has colors in it, whn zoomed a bit.

The same file after importing to unity,

11390-untitled.png

Could someone tell me why this is happening??

Your alpha values in the texture are very small. Most of the shaders in unity ignore the alpha channel of the texture, so in the preview or when using this texture on a material that does not use the alpha channel, the image will look fine. To see your image with the alpha channel, create a material using your texture and the Unlit/Transparent shader. Place this material on a game object. You will see your image as a ghost.