How to get all images for an image sequence? (from Python) When Blender references an image sequence, the image.filepath only ever references one image at a time.

However for renderfarms and copying projects between systems, you may want to get all the images associated with in image sequence.

How would you go about getting all the images in an image sequence for a Blender Image or Movie-Clip?
This function returns all the images which share the same prefix, suffix (and have a number suffix), eg:
/path/to/my_image_0001.png

def image_sequence_resolve_all(filepath):
    import os

    basedir, filename = os.path.split(filepath)
    filename_noext, ext = os.path.splitext(filename)

    from string import digits
    if isinstance(filepath, bytes):
        digits = digits.encode()
    filename_nodigits = filename_noext.rstrip(digits)

    if len(filename_nodigits) == len(filename_noext):
        # input isn't from a sequence
        return []

    return [
        f.path
        for f in os.scandir(basedir)
        if f.is_file() and
           f.name.startswith(filename_nodigits) and
           f.name.endswith(ext) and
           f.name[len(filename_nodigits):-len(ext) if ext else -1].isdigit()
    ]


# example use
print(resolve_image_sequence("/path/to/my_image_0001.png"))
&gt;&gt; ["/path/to/my_image_0001.png",
    "/path/to/my_image_0002.png",
    "/path/to/my_image_0003.png",
    ]