Library for representing file sequences.
Project description
Library for representing file sequences.
Install
pip install image_sequence
Instantiate from a file path
from image_sequence import ImageSequence
ImageSequence("/mock/path/file.1001.exr")
ImageSequence("/mock/path/file.%04d.exr")
ImageSequence("/mock/path/file.####.exr")
ImageSequence("/mock/path/file.<UDIM>.exr")
Finding frame ranges on disk.
from image_sequence import ImageSequence, find_sequence_on_disk
seq = ImageSequence("/mock/path/file.####.exr")
seq.find_frames_on_disk()
True
seq = find_sequence_on_disk("/mock/path/file.####.exr")
ImageSequence("/mock/path/file.####.exr")
Frame padding
from image_sequence import ImageSequence
seq = ImageSequence("/mock/path/file.101.exr")
print(seq.padding)
3
print(seq.path)
"/mock/path/file.%03d.exr"
seq.padding = 4
print(seq.path)
"/mock/path/file.%04d.exr"
Updating the sequence
from image_sequence import ImageSequence
seq = ImageSequence("/mock/path/file.1001.exr")
print(seq.path)
"/mock/path/file.%04d.exr"
print(seq.name)
"file"
seq.name = "newName"
print(seq.path)
"/mock/path/newName.%04d.exr"
print(seq.ext)
".exr"
seq.ext = ".jpg"
print(seq.path)
"/mock/path/newName.%04d.jpg"
seq.ext = ".exr"
print(seq.basename)
"newName.%04d.exr"
print(seq.dirname)
"/mock/path"
# Changing the padding style.
seq.padding_style = "@"
print(seq)
"/mock/path/newName.@@@@.exr"
# There is a built in UDIM type.
seq.padding_style = ImageSequence.UDIM_STYLE
print(seq.path)
"/mock/path/newName.<UDIM>.exr"
# The padding style can be set on the constructor.
seq = ImageSequence("/mock/path/fileName.1001.exr", padding_style=ImageSequence.UDIM_STYLE)
print(seq.path)
"/mock/path/fileName.<UDIM>.exr"
Formatting Image sequence (None of these methods will affect the sequence object).
from image_sequence import ImageSequence
seq = ImageSequence("/mock/path/file.1001.exr")
seq.eval_at_frame(9999)
"/mock/path/file.9999.exr"
print(seq.format_with_padding_style("#"))
"/mock/path/file.####.exr"
print(seq.format_with_padding_style("@", padding=2))
"/mock/path/file.@@.exr"
# The custom frame toke will only be set if frames exist.
print(seq.optional_frame_token_format("$F"))
"/mock/path/file.$F.exr"
seq = ImageSequence("/mock/path/file.exr")
print(seq.optional_frame_token_format("$F"))
"/mock/path/file.exr"
Frame ranges
from image_sequence import ImageSequence
seq = ImageSequence("/mock/path/file.1001.exr")
print(seq.frames)
[1001]
# Set frame range.
seq.frames = [10, 20, 30, 40]
# Querying frame range info
print(seq.start)
10
print(seq.end)
40
Get List of File Paths
from image_sequence import ImageSequence
seq = ImageSequence("/mock/path/file.###.exr")
seq.frames = [10, 20, 30, 40]
print(seq.get_paths())
[
"/mock/path/file.010.exr",
"/mock/path/file.020.exr",
"/mock/path/file.030.exr",
"/mock/path/file.040.exr"
]
# You can also offset the frame range.
print(seq.get_paths(offset=10))
[
"/mock/path/file.020.exr",
"/mock/path/file.030.exr",
"/mock/path/file.040.exr",
"/mock/path/file.050.exr"
]
License
Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
image_sequence-1.0.0.tar.gz
(17.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image_sequence-1.0.0.tar.gz.
File metadata
- Download URL: image_sequence-1.0.0.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf6fb5749282db3cad100580552bac089ff16aa217c75062141defb68823bb83
|
|
| MD5 |
bd162c6359f96f2dac0e112157e555de
|
|
| BLAKE2b-256 |
578900b5662573514e28ee12252648de3c14c072373d43eff4474e087ba146a7
|
File details
Details for the file image_sequence-1.0.0-py3-none-any.whl.
File metadata
- Download URL: image_sequence-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1233fac466316ec682ce7fce6879e2b51794e702044da4ae72ea162041e031d6
|
|
| MD5 |
e41e4b2b1b66cdbc32868435e29ab254
|
|
| BLAKE2b-256 |
2de50c56d650a60c6e3da0e6b4b1e3b5ee317c3c7290897a3aaea889e70201f2
|