mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 16:37:27 +00:00
Utility method to save frame as uncompressed PNG
This commit is contained in:
parent
9f2b22c4d6
commit
298daa4e83
1 changed files with 6 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue