Texture.saveToPngBytes

glib.bytes.Bytes saveToPngBytes()

Store the given texture in memory as a PNG file.

Use [gdk.texture.Texture.newFromBytes] to read it back.

If you want to serialize a texture, this is a convenient and portable way to do that.

If you need more control over the generated image, such as attaching metadata, you should look into an image handling library such as the gdk-pixbuf library.

If you are dealing with high dynamic range float data, you might also want to consider [gdk.texture.Texture.saveToTiffBytes] instead.

Returns

a newly allocated [glib.bytes.Bytes] containing PNG data