Image#

class ansys.dynamicreporting.core.serverless.item.Image(*args, **kwargs)#

Bases: FilePayloadMixin, Item

Item representing an image payload, optionally enhanced.

Methods

Image.add_tag(tag[, value])

Add or update a single tag.

Image.as_dict([recursive])

Serialize the model into a plain dictionary.

Image.create(**kwargs)

Factory-style creation that dispatches to the correct subclass.

Image.delete()

Delete the payload file and then the ORM instance.

Image.filter(**kwargs)

Return a collection of items, scoped by subclass type.

Image.find([query])

Search for items using an ADR query string.

Image.get(**kwargs)

Retrieve a single item instance, scoped by subclass type.

Image.get_tags()

Return the raw tag string stored on this object.

Image.reinit()

Reset the in-memory ORM state for this object.

Image.rem_tag(tag)

Remove a tag by key, if it exists.

Image.remove_tag(tag)

Alias for rem_tag() for backwards compatibility.

Image.render(*[, context, request])

Render the item as HTML.

Image.save(**kwargs)

Save the image payload, converting to PNG when appropriate.

Image.set_tags(tag_str)

Replace all tags with the given tag string.

Attributes

Image.content

Validated image file content for this item.

Image.dataset

Dataset associated with this item.

Image.db

Database alias in which this object is stored.

Image.enhanced

Whether this image is an enhanced image (for example TIFF with metadata).

Image.file_ext

File extension of the payload file, without the leading dot.

Image.file_path

Absolute path to the payload file, if available.

Image.has_file

Whether a payload file exists on disk.

Image.height

Image height in pixels.

Image.name

Human-readable name for the item.

Image.saved

Whether this object has been successfully saved to the database.

Image.sequence

Sequence index for ordering items within a dataset/session.

Image.session

Session that owns this item.

Image.source

Optional free-form source identifier for this item.

Image.tags

Tag string used to group and filter objects.

Image.type

Item type identifier for image items.

Image.width

Image width in pixels.

Image.date

Timestamp when the item was created.

Image.guid

Globally unique identifier for this object.

exception DoesNotExist(extra_detail: str = None)#

Bases: DoesNotExist

exception IntegrityError(extra_detail: str = None)#

Bases: IntegrityError

exception MultipleObjectsReturned(extra_detail: str = None)#

Bases: MultipleObjectsReturned

exception NotSaved(extra_detail: str = None)#

Bases: NotSaved

content: ImageContent = None#

Validated image file content for this item.

property enhanced#

Whether this image is an enhanced image (for example TIFF with metadata).

property height#

Image height in pixels.

save(**kwargs)#

Save the image payload, converting to PNG when appropriate.

Non-enhanced images are stored as PNG files, while enhanced images retain their original format. The file name is derived from the item GUID.

Parameters:
**kwargs

Keyword arguments forwarded to the database save method of the underlying ORM instance. For eg: The using argument can be used to select the target database alias.

Raises:
IntegrityError

If the database reports an integrity violation while saving.

InvalidFieldError

If invalid field names or values are supplied (via decorator).

ADRException

If an error occurs during image conversion.

Exception

Any other unexpected exception is propagated unchanged.

type: str = 'image'#

Item type identifier for image items.

property width#

Image width in pixels.