ImageCacher:
ImageCacher stores the most recently received image and uses Python’s hash() result to decide whether to return the stored image or replace it. This can preserve the previous image object when the same hash is seen again. The check does not compare image pixels, so it should not be treated as a reliable way to detect whether an image’s visual content has changed. The source also does not establish that this node speeds up earlier image-generation steps.
ImageCacher Input Parameters:
image
The required IMAGE to pass through the node. When its hash() result matches the stored hash, the node returns the previously stored image; otherwise, it stores and returns the image you supplied. This means the result depends on the hash comparison, not a pixel-by-pixel comparison. The interface specifies no default, minimum, maximum, or selectable options for this parameter.
ImageCacher Output Parameters:
IMAGE
The image returned by the node. It is the supplied image when the hash differs from the stored hash, or the previously stored image when the hashes match. The output is intended to carry an IMAGE into a later step of your workflow. The implementation does not show any image processing or visual changes before returning it.
ImageCacher Usage Tips:
- Connect an existing
IMAGEtoimage, then connectIMAGEto the next node where you need the image. - Use this node when retaining the last image object is useful to your workflow. Do not rely on it to identify identical-looking images or detect every pixel change; its decision is based on
hash(), not image content. - There are no cache-size, refresh, or other configuration settings in the supplied interface. If you need to confirm which image reached a later step, inspect that step’s result.
ImageCacher Common Errors and Solutions:
TypeError: unhashable type: ...
- Explanation: The implementation calls
hash(image). This error can occur if the supplied object does not support hashing. - Solution: Check that the connection supplies an
IMAGEaccepted by your environment. If a valid image still triggers the error, this implementation needs a different comparison method; the node has no setting that changes it.
AttributeError: type object ' ImageCacher' has no attribute 'image_hash'
- Explanation: The
IS_CHANGEDmethod readsimage_hashthrough its class-method argument, whileimage_hashis initialized on individual node instances. A call on the class may therefore raise this error. - Solution: This requires an implementation fix. Changing the image or reconnecting the node does not resolve the mismatch shown in the source.
Expected ... outputs, but received ... or an output-shape validation error
- Explanation: The interface declares one
IMAGEoutput, butcachereturns the image directly rather than wrapping it in a one-item tuple. Whether this causes an error depends on how the host validates node results. - Solution: Confirm the error is reported for ImageCacher. If it is, the implementation needs to return a one-item tuple in both branches; there is no interface setting to correct the return shape.
A changed image appears to return the previous image
- Explanation: The node compares hashes rather than pixels. A matching hash makes it return the stored image, even though the code has not checked whether the images look the same.
- Solution: Inspect the image before and after this node. For workflows that must detect visual changes, use a content-based comparison or an implementation designed for that purpose.
