create a texture 2d with screen width and height but dont include a button in it

i want to create a texture 2d with same as screen width and height
i want to readpixel from screen width and height b ut not want to include a button in it
i have a button on screen that button is also coming in texture

Create a Texture2D and apply it to a UI Image component.

Create Texture2D

Script Reference: Texture2D

Unity Tutorials - UI

Put your ReadPixel code under OnPostRender(), attach the script to Camera. OnPostRender is called just after rendering a scene and before GUI objects are drawn, so ReadPixels won’t read any UI elements.

Read More here: