Utility method to save frame as uncompressed PNG

This commit is contained in:
Kovid Goyal 2025-10-09 10:56:33 +05:30
parent 9f2b22c4d6
commit 298daa4e83
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -10,6 +10,7 @@ import (
"image"
"image/color"
"image/gif"
"image/png"
"io"
"os"
"os/exec"
@ -176,6 +177,11 @@ type SerializableImageMetadata struct {
const SERIALIZE_VERSION = 1
func (self *ImageFrame) SaveAsUncompressedPNG(output io.Writer) error {
encoder := png.Encoder{CompressionLevel: png.NoCompression}
return encoder.Encode(output, self.Img)
}
func (self *ImageData) SerializeOnlyMetadata() SerializableImageMetadata {
f := make([]SerializableImageFrame, len(self.Frames))
for i, s := range self.Frames {