How Can I take a "edited" screenshot in a 2D game?

I wrote this code following a tutorial, my question is how can I include in the screenshot only the sprite and the background

public class ScreenshotsHandler : MonoBehaviour
{

    private static ScreenshotsHandler instance;
    private Camera myCamera;
    private bool takeScreenshotOnNextFrame;

    private void Awake(){
        instance = this;
        myCamera = gameObject.GetComponent<Camera>();
    }

    private void OnPostRender() {
            if  (takeScreenshotOnNextFrame) {
                takeScreenshotOnNextFrame = false;
                RenderTexture renderTexture = myCamera.targetTexture;

            Texture2D renderResult = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.ARGB32,false);
            Rect rect = new Rect(0,0,renderTexture.width,renderTexture.height);
            renderResult.ReadPixels(rect, 0, 0);


            byte[] byteArray = renderResult.EncodeToPNG();
            System.IO.File.WriteAllBytes(Application.dataPath + "/Screenshot.png",byteArray);
            Debug.Log("Screenshot salvato!");


            RenderTexture.ReleaseTemporary(renderTexture);
            myCamera.targetTexture = null;
            }
        }


    private void TakeScreenshot(int width, int height){
        myCamera.targetTexture = RenderTexture.GetTemporary(width, height, 16);
        takeScreenshotOnNextFrame = true;



    }

    public static void TakeSCreenshot_Static (int width, int height){
            instance.TakeScreenshot(width,height);
    }

    private void start (){

    }

    private void Update(){
        if (Input.GetKeyDown(KeyCode.Insert)) {

            ScreenshotsHandler.TakeSCreenshot_Static (1920, 1080);
        }

    }
}

You can achieve this by using a second camera for the screenshot, that is set to only see the layers that you want to include in the screenshot.

Set the layers of the objects to something other than default, and then set the culling mask of your screenshot camera to only see those layers.