How to export a PNG screenshot with transparency?
To take a screenshot with LÖVE 0.9.0 you used [love.graphics.newScreenshot] and set the argument [copyAlpha] to true, and a PNG would be rendered with transparency based on the alpha applied on draw().
LÖVE 0.11.0 replaced the function with [love.graphics.captureScreenshot] but removed the [copyAlpha] argument and now render weird opaque PNGs compared to the older version.
To make matters worse, the older function tested on 0.9.0 don't works properly with Windows 10 rendering a PNG with thumbnail but a blank transparent image. It is fine on Windows 7.
How to export PNG screenshot with transparency?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to export PNG screenshot with transparency?
You can try drawing to a canvas instead of the screen, and saving via Canvas:newImageData.
Note however that OpenGL does not support proper alpha compositing without a custom shader, so if you use normal blending mode, the PNG you will obtain will have premultiplied alpha, which is not supported by PNG. You can try to "unmultiply" it; GIMP 2.10 has such a tool as a GEGL operation, but due to having just 256 levels, there will be quality loss.
Note however that OpenGL does not support proper alpha compositing without a custom shader, so if you use normal blending mode, the PNG you will obtain will have premultiplied alpha, which is not supported by PNG. You can try to "unmultiply" it; GIMP 2.10 has such a tool as a GEGL operation, but due to having just 256 levels, there will be quality loss.
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 5 guests