Notifications
Clear all

Regarding the issue of incorrect colors in the image after taking a viewport snapshot.

 XGM

I’ve written a viewport snapshot plugin, but the captured image has gamma issues. Is there any way to fix this? I tried applying gamma correction in the code, but it seems ineffective. Could you please help me?

 

(
    -- Capture the viewport to memory
    vptGrabBMP = gw.getViewportDib()

    if vptGrabBMP != undefined do
    (
        -- Apply gamma correction (set to 2.2 for standard display)
        local inputGamma = 2.2
        vptGrabBMP.gamma = inputGamma

        -- Copy the bitmap to clipboard
        setclipboardbitmap vptGrabBMP
    )

    -- Free memory after use
    free vptGrabBMP
    gc()
)
Reply