Screencapture.screenshot image is faint or translucent (Android)


I followed this tutorial on taking a screenshot using Unity’s Screencapture.Capturescreenshot() method.

It seemed pretty straight-forward and easy to follow. However, on display, the screenshot image (a basic cube in 3D space) appears translucent. Does anyone have any idea why and how I can fix it so it shows a true screen shot? I used another phone to take a picture of my actual screen when I’m taking the screen shot here (Sorry it’s a little blurry. The cube moves):

And then what it looks like on display here
(Notice how you can see through it)

Here is the code for the screen capture script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TakeScreenshot : MonoBehaviour {

	public void TakeAShot()
		StartCoroutine ("CaptureIt");

	IEnumerator CaptureIt()
		string timeStamp = System.DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss");
		string fileName = "Screenshot" + timeStamp + ".png";
		string pathToSave = fileName;
		yield return new WaitForEndOfFrame();


And here is the code for displaying. It converts the .png file to a texture, makes a sprite out of the texture, and displays the sprite on the canvas.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;

public class ScreenshotPreview : MonoBehaviour {
	public GameObject canvas;
	string[] files = null;
	int whichScreenShotIsShown= 0;

	// Use this for initialization
	void Start () {
		files = Directory.GetFiles(Application.persistentDataPath + "/", "*.png");
		if (files.Length > 0) {
			GetPictureAndShowIt ();

	void GetPictureAndShowIt()
		string pathToFile = files [whichScreenShotIsShown];
		Texture2D texture = GetScreenshotImage (pathToFile);
		Sprite sp = Sprite.Create (texture, new Rect (0, 0, texture.width, texture.height),
			new Vector2 (0.5f, 0.5f));
		canvas.GetComponent<Image> ().sprite = sp;

	Texture2D GetScreenshotImage(string filePath)
		Texture2D texture = null;
		byte[] fileBytes;
		if (File.Exists (filePath)) {
			fileBytes = File.ReadAllBytes (filePath);
			texture = new Texture2D (2, 2, TextureFormat.RGB24, false);
			texture.LoadImage (fileBytes);
		return texture;

It all works fine in the tutorial. I am using Android. Thank you in advance for your constructive ideas.

It turns out that the ‘alpha’ value for my panel in the second scene was at about 50%, which in alpha values is about 127. To display the image exactly as it was taken on the screen, alpha needs to be at 255 , which represent 0% transparency. In general, many people want UI elements to have a degree of transparency so that you can see the main scene behind the UI elements. However, for viewing the screenshot I wanted no transparency. Therefore => Select the Panel in your hierarchy. Go to the Color quality in the Inspector. Double-click. Then set the Alpha value to 255.

If you have a situation where you do not have a dedicated scene just for viewing your screenshot, you can change the alpha value using a script. In my case I could set my alpha to 255 permanently because the only purpose for that scene was to display screenshots.