---
name: "Gtk2::Gdk::Image"
section: "3pm"
platform: "linux"
package: "libgtk2-perl-doc"
version: "2:1.24992-1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/Gtk2::Gdk::Image"
---

# Gtk2::Gdk::Image(3pm)

wrapper for GdkImage

## NAME

Gtk2::Gdk::Image - wrapper for GdkImage

## DESCRIPTION

A `"Gtk2::Gdk::Image"` is a 2-D array of pixel values in client-side memory.  It can optionally use shared memory with the X server for fast copying to or from a window or pixmap.

If you're thinking of using this then look at `"Gtk2::Gdk::Pixbuf"` first.  GdkPixbuf has many more features, in particular file read and write (PNG, JPEG, etc).  But a GdkImage lets you work directly in pixel values instead of expanding to RGB components.

See Gtk2::Gdk::Drawable for `"draw_image"`, `"get_image"` and `"copy_to_image"` methods to draw or fetch images to or from a window or pixmap.

The various `"get"` methods are Gtk 2.22 style.  For previous versions they're direct field access.

## HIERARCHY

```
  Glib::Object
  +----Gtk2::Gdk::Image
```

## METHODS

### image or undef = Gtk2::Gdk::Image-\>new ($type, $visual, $width, $height)

- •

  `$type` (Gtk2::Gdk::ImageType)

- •

  `$visual` (Gtk2::Gdk::Visual)

- •

  `$width` (integer)

- •

  `$height` (integer)

### integer = $image-\>get\_bits\_per\_pixel

### byteorder = $image-\>get\_byte\_order

### integer = $image-\>get\_bytes\_per\_line

### integer = $image-\>get\_bytes\_per\_pixel

### colormap = $image-\>get\_colormap

### $image-\>set\_colormap ($colormap)

- •

  `$colormap` (Gtk2::Gdk::Colormap)

### integer = $image-\>get\_depth

### integer = $image-\>get\_height

### imagetype = $image-\>get\_image\_type

### unsigned = $image-\>get\_pixel ($x, $y)

- •

  `$x` (integer)

- •

  `$y` (integer)

### string = $image-\>get\_pixels()

Return a copy of the raw pixel data memory from `$image`.  This is `"bytes_per_line * height"` many bytes.

### $image-\>put\_pixel ($x, $y, $pixel)

- •

  `$x` (integer)

- •

  `$y` (integer)

- •

  `$pixel` (unsigned)

### visual = $image-\>get\_visual

### integer = $image-\>get\_width

## ENUMS AND FLAGS

### enum Gtk2::Gdk::ByteOrder

- •

  'lsb-first' / 'GDK\_LSB\_FIRST'

- •

  'msb-first' / 'GDK\_MSB\_FIRST'

### enum Gtk2::Gdk::ImageType

- •

  'normal' / 'GDK\_IMAGE\_NORMAL'

- •

  'shared' / 'GDK\_IMAGE\_SHARED'

- •

  'fastest' / 'GDK\_IMAGE\_FASTEST'

## SEE ALSO

Gtk2, Glib::Object

## COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL.  See Gtk2 for a full notice.
