### Method

# Gdk Texture save_to_png_bytes

since: 4.6

#### Declaration [src]

    GBytes*
    gdk_texture_save_to_png_bytes (
      GdkTexture* texture
    )

#### Description [src]

Store the given `texture` in memory as a PNG file.

Use `gdk_texture_new_from_bytes()` 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_save_to_tiff_bytes()` instead.

Available since: 4.6

#### Return value

Type: `GBytes`

A newly allocated `GBytes` containing PNG data.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.