Skip to content

Crisp Upscale

This example assumes using Recraft; is in scope and apiKey contains your Recraft API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
using var client = new RecraftClient(apiKey);

// Create a placeholder 1x1 pixel PNG for demonstration
var imageBytes = new byte[] { 0x89, 0x50, 0x4E, 0x47 };

ProcessImageResponse response = await client.Image.CrispUpscaleAsync(
    request: new ProcessImageRequest
    {
        Image = imageBytes,
        Imagename = "low-res.png",
        ResponseFormat = ResponseFormat.Url,
    });

Console.WriteLine($"Image ID: {response.Image.ImageId}");
Console.WriteLine($"Upscaled URL: {response.Image.Url}");
Console.WriteLine($"Credits used: {response.Credits}");