mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Utility method to save frame as uncompressed PNG
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/gif"
|
"image/gif"
|
||||||
|
"image/png"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -176,6 +177,11 @@ type SerializableImageMetadata struct {
|
|||||||
|
|
||||||
const SERIALIZE_VERSION = 1
|
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 {
|
func (self *ImageData) SerializeOnlyMetadata() SerializableImageMetadata {
|
||||||
f := make([]SerializableImageFrame, len(self.Frames))
|
f := make([]SerializableImageFrame, len(self.Frames))
|
||||||
for i, s := range self.Frames {
|
for i, s := range self.Frames {
|
||||||
|
|||||||
Reference in New Issue
Block a user