AppStreamCompose.ImageTarget

Fields

None

Methods

class

new (name, scale_mode, width, height)

copy ()

get_error_message ()

get_height ()

get_name ()

get_only_downscale ()

get_result_height ()

get_result_width ()

get_save_flags ()

get_scale_mode ()

get_skipped ()

get_source_size_range ()

get_width ()

set_only_downscale (only_downscale)

set_save_flags (flags)

set_source_size_range (min_width, min_height, max_width, max_height)

Details

class AppStreamCompose.ImageTarget

Describes one requested output rendition of a media operation, and carries its result data after the operation was run. Renditions that were skipped due to one of their source-size conditions are not an error: the operation still succeeds, and AppStreamCompose.ImageTarget.get_skipped will return True.

Added in version 1.2.0.

classmethod new(name, scale_mode, width, height)
Parameters:
Returns:

an AppStreamCompose.ImageTarget

Return type:

AppStreamCompose.ImageTarget

Create a new AppStreamCompose.ImageTarget. The image format the rendition is stored in is derived from the file extension of name.

name must be a single path segment: it is resolved relative to the output directory of the media operation, and must not contain any directory components or refer to a parent directory.

Added in version 1.2.0.

copy()
Returns:

a new AppStreamCompose.ImageTarget

Return type:

AppStreamCompose.ImageTarget

Create a deep copy of an AppStreamCompose.ImageTarget, including any result data it may already carry.

Added in version 1.2.0.

get_error_message()
Returns:

The error message, or None if this rendition was fine.

Return type:

str or None

Get the error message in case creating this particular rendition failed. A failed rendition does not fail the media operation as a whole.

Added in version 1.2.0.

get_height()
Returns:

The requested height in pixels.

Return type:

int

Get the requested height of this rendition. Depending on the scale mode, this may differ from the height the rendition is actually stored at.

Added in version 1.2.0.

get_name()
Returns:

The rendition filename.

Return type:

str

Get the filename this rendition is stored as.

Added in version 1.2.0.

get_only_downscale()
Returns:

True if the rendition is never upscaled.

Return type:

bool

Get whether this rendition should be skipped rather than considering to upscale it to the target size(s).

Added in version 1.2.0.

get_result_height()
Returns:

The rendition height in pixels, or 0 if it was not stored.

Return type:

int

Get the actual height of the stored rendition.

Added in version 1.2.0.

get_result_width()
Returns:

The rendition width in pixels, or 0 if it was not stored.

Return type:

int

Get the actual width of the stored rendition.

Added in version 1.2.0.

get_save_flags()
Returns:

the AppStreamCompose.ImageSaveFlags in use.

Return type:

AppStreamCompose.ImageSaveFlags

Get the flags used when storing this rendition.

Added in version 1.2.0.

get_scale_mode()
Returns:

an AppStreamCompose.ImageScaleMode

Return type:

AppStreamCompose.ImageScaleMode

Get the scaling mode this rendition is created with.

Added in version 1.2.0.

get_skipped()
Returns:

True if no file was written for this rendition.

Return type:

bool

Check whether this rendition was skipped because the source image did not satisfy its source-size conditions. Only valid after the media operation this target was passed to has completed successfully.

Added in version 1.2.0.

get_source_size_range()
Returns:

min_width:

Destination of the minimum source image width.

min_height:

Destination of the minimum source image height.

max_width:

Destination of the maximum source image width.

max_height:

Destination of the maximum source image height.

Return type:

(min_width: int, min_height: int, max_width: int, max_height: int)

Get the source image dimensions this rendition is restricted to. A value of 0 means that the respective dimension is not limited.

Added in version 1.2.0.

get_width()
Returns:

The requested width in pixels.

Return type:

int

Get the requested width of this rendition. Depending on the scale mode, this may differ from the width the rendition is actually stored at.

Added in version 1.2.0.

set_only_downscale(only_downscale)
Parameters:

only_downscale (bool) – True to never upscale.

Set whether this rendition should be skipped in case creating it would mean upscaling the source image.

Added in version 1.2.0.

set_save_flags(flags)
Parameters:

flags (AppStreamCompose.ImageSaveFlags) – the AppStreamCompose.ImageSaveFlags to use.

Set the flags used when storing this rendition.

Added in version 1.2.0.

set_source_size_range(min_width, min_height, max_width, max_height)
Parameters:
  • min_width (int) – Minimum source image width, or 0 for no limit.

  • min_height (int) – Minimum source image height, or 0 for no limit.

  • max_width (int) – Maximum source image width, or 0 for no limit.

  • max_height (int) – Maximum source image height, or 0 for no limit.

Restrict the source images this rendition is created for. If the source image’s dimensions fall outside of the given range, the rendition is skipped and no file is written for it, while the media operation as a whole still succeeds.

Added in version 1.2.0.