Skip to content

Always copy images as PNGs

Noah Davis requested to merge work/ndavis/image-copying into master

Uncompressed QImages can take ~30x more space than PNGs, so we can save a lot of space by converting to PNG. After Spectacle is closed, the system converts to PNG anyway, but not before Spectacle is closed.

We can't really copy the image in the user's save format. This is partly because the system will decompress the data after Spectacle closes and partly because formats other than PNG can't be directly pasted into Firefox/Chromium/WebKit/Electron based apps. PNG is unaffected by the decompression issue, but lossy formats like JPEG and WEBP can expand 2-8x their compressed size. We don't use QMimeData::setImageData because it doesn't preserve the original format. You can sometimes use setImageData and preserve the format only while Spectacle is open by setting the original mimetype followed by setImageData, but it's unreliable and doesn't fix the decompression issue.

BUG: 485096 CCBUG: 465781 CCBUG: 465972

Merge request reports