how to overlay transparent png image?

I’m trying to overlay a transparent png over original image(Lena.jpg). I used addWeighted function to blend. It didn’t give me a good result. Is there any other way to overlay two images. My desirable output is spectacles visible with transparent rectangular region on Lena image.
Kindly Help.
97304-texturetomatdisplay.png

first of all you need go to the import settings of your images. select Advanced for a texture type. then check the box to make them readable. here is a quick script i wrote to give you the idea. this should work if the second image is not bigger than the first. resizing is another question!

public Texture2D img1;// start texture
public Texture2D img2;// overlay this over top  
public Texture2D result;
Color col;
float alph;
void Start () {

		int x = img2.width;
		int y = img2.height;
		result = new Texture2D (x,y);
		// loop through your pixels
		while(x>0){x--;
			y=img2.height;
		while(y>0){y--;
				//use the alpha channel of 2nd image to mix the colors
				alph = img2.GetPixel(x,y).a;

                             // remove this next line if you don't want alpha cutoff!
                            if(alph>.5f){alph=1f;}else{alph=0;}

				col= img2.GetPixel(x,y);
				col= col*alph;
				alph=1f-alph;
				col=col+img1.GetPixel(x,y)*alph;
				result.SetPixel(x,y,col);
}}
		result.Apply ();
	}

of course you could alteratively write a similar custom shader script.

If you just want a png with transparency to sit on top of another image, you can do it without code.

Tick “Alpha is transparency” on the image, and setting the Material shader to Cutout (standard in cutout mode, or “Unlit/Transparent Cutout”). Add planes with each image, and make sure the glasses one is in front of the person.

See: https://lmhpoly.com/unity-tutorial-how-to-create-transparent-texture/