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
class mocha.project.ImageData(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:PyObject

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

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

ImageData.__ne__(rhs)
Return type:PySide2.QtCore.bool
ImageData.__eq__(rhs)
Return type:PySide2.QtCore.bool
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:mocha.project.PixelFormat
Access:read-write

Provides access to the pixel format.

ImageData.channel_type
Type:mocha.project.ChannelType
Access:read-write

Provides access to the image channel type.