2.7. ImageData

2.7.1. Synopsis

2.7.1.1. Functions

2.7.1.2. Properties

  • property channel_type [read-write] of ChannelType

  • property height [read-write] of int

  • property pixel_format [read-write] of PixelFormat

  • property pixels [read-write] of array.array

  • property width [read-write] of int

2.7.2. Detailed Description

Main class for access to main image data fields.

class mocha.project.ImageData
ImageData.flip()

Vertically flips the image in-place.

Deprecated since version 5.5.2: Use 3rd party libs for images flipping

ImageData.flipped_pixels()
Return type

object

Returns a flipped upside-down copy of the pixel buffer.

Deprecated since version 5.5.2: Use 3rd party libs for images flipping

ImageData.get_pixels()
Return type

object

ImageData.__ne__(rhs)
Return type

bool

ImageData.__eq__(rhs)
Return type

bool

ImageData.set_pixels(arg__1)
ImageData.pixels
Type

array.array

Access

read-write Provides access to a pixel buffer.

IMPORTANT The getter returns a weak reference to the array instance as mocha owns the pixel buffer exclusively. Do not store the effective array reference anywhere because despite the reference counter value mocha kills the array instance as soon as the corresponding internal image structure gets destroyed.

The setter accepts a normal array reference, acquires it immediately and to avoid dangling references makes the array reference variable to point to the None object unless it’s an rvalue.

ImageData.width
Type

int

Access

read-write Provides access to the image width value.

ImageData.height
Type

int

Access

read-write Provides access to the image height value.

ImageData.pixel_format
Type

PixelFormat

Access

read-write Provides access to the pixel format.

ImageData.channel_type
Type

ChannelType

Access

read-write Provides access to the image channel type.