I am trying to dig deeper into the Flax API, and I am looking for an equivalent of saving a RenderTexture to disk as jpeg. The Unity code is something like this:
using UnityEngine;
using System.IO;
    public static void SaveAsJPG(this RenderTexture renderTexture, string filePath, int quality = 75)
    {
        // Create a temporary texture to hold the render output
        Texture2D tex = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.RGB24, false);
        // Activate the render texture and read its pixels
        RenderTexture.active = renderTexture;
        tex.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
        tex.Apply();
        // Encode the texture as a JPG
        byte[] bytes = tex.EncodeToJPG(quality);
        // Write the bytes to the file
        File.WriteAllBytes(filePath, bytes); 
        // Clean up resources
        RenderTexture.active = null; // Restore the previous active render texture
        Destroy(tex); 
    }
Is this possible in Flax (not in the editor, in the published application), and what would the equivalent code be?
Basically I want to render something using a custom shader and custom data to a render target, then save this as an image.