Thumbnails#
- apsync.attach_thumbnail(file_path: str, local_file: str, is_detail: bool = True) None #
Attaches the local_file as a thumbnail to file_path. Set is_detail = False to specifically set a an image for the Anchorpoint browser preview. Setting a downscaled version of the thumbnail for the preview is a nice optimization to improve browsing performance. Only use image formats such as PNG and JPEG.
- Parameters
file_path (str) – Path to the file
local_file (str) – Path to the local image that should be set as the thumbnail
is_detail (bool) – Whether or not the image is for the browser preview
Example
>>> apsync.attach_thumbnail("my_scene.blend", "my_rendering.png")
- apsync.get_thumbnail(file_path: str, is_detail: bool) Optional[str] #
Retrieves the thumbnail of file_path (or None). Set is_detail = False to retrieve the preview image - if any.
- Parameters
file_path (str) – Path to the file
is_detail (bool) – Detail or preview image
- Returns
The path to the locally cached thumbnail - or None.
Example
>>> detail_thumbnail = apsync.get_thumbnail("my_scene.blend")
- apsync.generate_thumbnails(file_paths: List[str], output_directory: str, with_preview: bool = True, with_detail: bool = False, workspace_id: Optional[str] = None) List[str] #
Generates thumbnails for multiple file_paths resulting in file_name_pt.png for each preview thumbnail and file_name_dt.png for each detail thumbnail in the given output directory
Set with_preview = False to skip generating preview thumbnail Set with_detail = True to generate a detail thumbnail (not supported for all file formats)
- Parameters
file_paths (str) – Path to the file (do not mix paths from multiple projects)
output_directory (str) – output directory for preview and detail thumbnail
with_preview (bool) – generate preview image - default is True
with_detail (bool) – generate detail image if supported - default is False
workspace_id – workspace id when files are not inside a project or None
- Returns
list of file_paths for which generation was successful
Example
>>> successful_file_paths = apsync.generate_thumbnails(list_of_paths, "some/output/path")
- apsync.generate_thumbnail(file_path: str, output_directory: str, with_preview: bool = True, with_detail: bool = False, workspace_id: Optional[str] = None) bool #
Generates a thumbnail for file_path resulting in file_name_pt.png for preview thumbnail and file_name_dt.png for detail thumbnail in the given output directory
Set with_preview = False to skip generating preview thumbnail Set with_detail = True to generate a detail thumbnail (not supported for all file formats)
- Parameters
file_path (str) – Path to the file
output_directory (str) – output directory for preview and detail thumbnail
with_preview (bool) – generate preview image - default is True
with_detail (bool) – generate detail image if supported - default is False
workspace_id – workspace id when files are not inside a project or None
- Returns
bool if generation was successful
Example
>>> success = apsync.generate_thumbnail("some/path/my_scene.blend", "some/output/path")