Skip to content

[enhancement]: add a method to get the path of an image from the invocation context #6175

@fieldOfView

Description

@fieldOfView

Is there an existing issue for this?

  • I have searched the existing issues

Contact Details

No response

What should this feature add?

4.0 introduced a restrictive API for the invocation context (see #5491). This API does not seem to include a way to get the file path of an image. The image contents are available via context.images.get_pil and a public url is available via context.images.get_dto, but the only way to get the local path is by accessing the 'private' context._services.images class.

Getting the file path of a (compressed) image is useful for example when POSTing an image to a different server, like I do in the Remote Image nodes (https://github.com/fieldOfView/InvokeAI-remote_image).

The most straightforward way to disclose the local path of an image is by adding a get_path method to the ImagesInterface class. I can draft a PR for that.

Alternatives

Alternatively, I could

  • Use the private context._services to get at the images.get_path method
  • Load the PIL image and recompress it (and POST the result)
  • GET the file through the API (and POST the result)

Additional Content

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions