mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
Utility method to save frame as uncompressed PNG
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user