Sign in Get started

Images

Upload, fetch, download, and delete individual images.

View as Markdown

For bulk operations across many images, prefer the upload workflow and the batch resource. This page is for single-image ops.

from pictograph import Client
client = Client()

get

Fetch metadata for a single image.

image = client.images.get("img-uuid-1")
print(image.filename, image.status, image.annotation_count)

Returns Image. Annotations live on the annotations resource — call client.annotations.get(image.id) to fetch them.

upload

Upload a local file to a dataset. Three steps under the hood: get a signed upload URL → PUT the bytes → register the image.

from pathlib import Path

project = client.projects.get("my-dataset")
image = client.images.upload(
    dataset_id=project.id,
    file_path=Path("./photo.jpg"),
    folder_path="/cars",          # virtual folder on the dataset
)
ArgTypeDefaultNotes
dataset_idstrrequiredUUID of the destination dataset
file_pathstr | PathrequiredLocal file. Pillow extracts dimensions client-side
folder_pathstr"/"Virtual folder (e.g. /cars). Storage paths are immutable
idempotency_keystr | NoneautoOverride the auto-generated dedup key

Returns Image. Raises ConflictError if a file with the same name already exists in the same folder.

Supported extensions: .jpg, .jpeg, .png, .webp, .bmp, .tif, .tiff, .gif, .heic. HEIC is auto-converted to PNG server-side.

download

Stream the original image bytes to a local file (chunked, safe for large images).

client.images.download("img-uuid-1", output_path="./photo.jpg")
ArgTypeDefault
image_idstrrequired
output_pathstr | Pathrequired

The bytes are served via Cloud CDN with 30-day edge caching, so repeat downloads are fast.

delete

Soft-delete (archive) by default. Set permanent=True to free the stored bytes — irreversible.

client.images.delete("img-uuid-1")                  # archive (recoverable)
client.images.delete("img-uuid-1", permanent=True)  # permanent

Permanent deletes require member+ role on the API key.

Bulk uploads

For directories of images, use the workflow:

from pictograph.workflows import upload_dataset_from_folder

report = upload_dataset_from_folder(
    client,
    "my-dataset",
    folder="./photos",
    organize_by_class=True,   # subdirectory → virtual folder
    parallel=True,
    max_workers=8,
)
print(report.images_uploaded, len(report.failures))

See Quick Start for the full workflow surface.

Common errors

StatusExceptionCause
404NotFoundErrorimage_id doesn’t exist, or belongs to another org
409ConflictErrorFilename collision in the same virtual folder
413ApiErrorUploaded file exceeds 50 MB
415ValidationErrorUnsupported file extension
Copied to clipboard