Sign in Get started

Images

List, upload, download, review, split and tag a dataset's images. Upload one file, up to 500 at once, or a whole folder from Python, the CLI or REST.

View as Markdown
On this page

A dataset’s images, one at a time. To move, copy, tag or delete many at once, use Batch.

Addressing an image

An image’s address is its path in the dataset: train/stop-sign-0421.jpg is stop-sign-0421.jpg in /train, and a bare filename is at the root. REST puts the path after the dataset: /api/v1/developer/images/road-signs/train/stop-sign-0421.jpg.

Every image the SDK returns has its address in .path, so results pass straight back: client.images.review("road-signs", image.path, action="approve"). A bare filename for an image not at the root is a 404 that names the path to use.

list

One page of a dataset’s images, newest first, filtered by directory, stage, split or model confidence. iter walks them all.

Source: Images.list

Arg Type Default Notes
dataset str required Dataset name or id
directory str | None None Only this directory, e.g. /train (not subdirectories)
filename str | None None Only images with this filename, in any directory
status ImageStatus | None None Only this stage: new, annotate, review or complete
split ImageSplit | None None Only this split: train, val or test
include_archived bool False Include archived images
min_confidence_lt float | None None Only images whose least confident annotation is below this (0 to 1)
limit int 100 Page size (max 1,000)
offset int 0 Items to skip
images = client.images.list(
    dataset="road-signs",
    directory="/train",
    limit=50,
)
for img in images:
    print(img.filename, img.status, img.annotation_count, img.min_confidence)
pictograph images list road-signs --directory /train --limit 50
pictograph images list road-signs --status complete --min-confidence-lt 0.9
curl -s "https://api.pictograph.io/api/v1/developer/images/?dataset=road-signs&directory=/train&status=complete&limit=50&offset=0" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns list[Image]

Image · 18 fields
class Image(BaseModel):
    """An image within a Pictograph dataset."""
    id: str
    # Its dataset's id.
    dataset_id: str | None = None
    filename: str
    # Its labeling stage.
    status: Literal['new', 'annotate', 'review', 'complete'] = 'new'
    # train, val or test; None if unassigned.
    split: Optional[Literal['train', 'val', 'test']] = None
    annotation_count: int = 0
    # The lowest confidence among its annotations, 0 to 1 (1.0 for hand-drawn);
    # `images.list(min_confidence_lt=...)` filters by it for a review queue. None for
    # images saved before it was recorded.
    min_confidence: float | None = None
    # File size in bytes.
    file_size: int = 0
    # Width in pixels; None if unknown.
    width: int | None = None
    # Height in pixels; None if unknown.
    height: int | None = None
    # Stored MIME type, e.g. 'image/png'.
    content_type: str | None = None
    # Its directory in the dataset (`/` for the root).
    directory_path: str | None = None
    # Tags set by people (`images.bulk_tag` writes them), not auto-tags.
    tags: list[str] = []
    # True when archived; delete with `permanent=True` to remove it for good.
    is_archived: bool = False
    # URL of the full image; fetching it needs your X-API-Key (`images.download` saves
    # it to disk).
    image_url: str | None = None
    # CDN URL of a thumbnail, about 200 px.
    thumbnail_url: str | None = None
    # API URL of its annotations, as JSON.
    annotation_url: str | None = None
    created_at: datetime

    # The image's address in its dataset - pass it as `image` to any per-image call.
    @property
    def path(self) -> str: ...

REST returns {"data": [...], "pagination": {"limit", "offset", "total", "has_more", "next_cursor"}}; pass next_cursor as cursor for the next page.

iter

Every matching image, fetched page by page; .all() returns a list and .first() the first item. Same filters as list.

Source: Images.iter

Arg Type Default Notes
dataset str required Dataset name or id
directory str | None None As in list
filename str | None None As in list
status ImageStatus | None None As in list
split ImageSplit | None None As in list
include_archived bool False As in list
min_confidence_lt float | None None As in list
page_size int 100 Items fetched per request (max 1,000)
max_total int | None None Stop after this many items
# Walk an entire directory, paging transparently
for img in client.images.iter(dataset="road-signs", directory="/train"):
    print(img.filename)

# Cap the total and materialize to a list
complete = client.images.iter(
    dataset="road-signs",
    status="complete",
    max_total=500,
).all()

# Active learning: page the images a model was least confident about.
# Every listed image carries `min_confidence` (1.0 = certain).
for img in client.images.iter(dataset="road-signs", min_confidence_lt=0.9):
    print(img.filename, img.min_confidence)
# The CLI list command pages for you - --limit is a total, not a page size.
pictograph images list road-signs --directory /train --limit 5000
# Each page's pagination.next_cursor is the next request's cursor.
curl -s "https://api.pictograph.io/api/v1/developer/images/?dataset=road-signs&directory=/train&limit=100&cursor=$NEXT_CURSOR" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns CursorPager[Image]

Image · 18 fields
class Image(BaseModel):
    """An image within a Pictograph dataset."""
    id: str
    # Its dataset's id.
    dataset_id: str | None = None
    filename: str
    # Its labeling stage.
    status: Literal['new', 'annotate', 'review', 'complete'] = 'new'
    # train, val or test; None if unassigned.
    split: Optional[Literal['train', 'val', 'test']] = None
    annotation_count: int = 0
    # The lowest confidence among its annotations, 0 to 1 (1.0 for hand-drawn);
    # `images.list(min_confidence_lt=...)` filters by it for a review queue. None for
    # images saved before it was recorded.
    min_confidence: float | None = None
    # File size in bytes.
    file_size: int = 0
    # Width in pixels; None if unknown.
    width: int | None = None
    # Height in pixels; None if unknown.
    height: int | None = None
    # Stored MIME type, e.g. 'image/png'.
    content_type: str | None = None
    # Its directory in the dataset (`/` for the root).
    directory_path: str | None = None
    # Tags set by people (`images.bulk_tag` writes them), not auto-tags.
    tags: list[str] = []
    # True when archived; delete with `permanent=True` to remove it for good.
    is_archived: bool = False
    # URL of the full image; fetching it needs your X-API-Key (`images.download` saves
    # it to disk).
    image_url: str | None = None
    # CDN URL of a thumbnail, about 200 px.
    thumbnail_url: str | None = None
    # API URL of its annotations, as JSON.
    annotation_url: str | None = None
    created_at: datetime

    # The image's address in its dataset - pass it as `image` to any per-image call.
    @property
    def path(self) -> str: ...

get

One image’s details.

Source: Images.get

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
image = client.images.get(
    dataset="road-signs",
    image="train/stop-sign-0421.jpg",
)
print(image.path, image.status, image.annotation_count)
pictograph images get road-signs train/stop-sign-0421.jpg
curl -s "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg/metadata" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

# Embed the annotations in the same response:
curl -s "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg/metadata?include_annotations=true" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns Image

Image · 18 fields
class Image(BaseModel):
    """An image within a Pictograph dataset."""
    id: str
    # Its dataset's id.
    dataset_id: str | None = None
    filename: str
    # Its labeling stage.
    status: Literal['new', 'annotate', 'review', 'complete'] = 'new'
    # train, val or test; None if unassigned.
    split: Optional[Literal['train', 'val', 'test']] = None
    annotation_count: int = 0
    # The lowest confidence among its annotations, 0 to 1 (1.0 for hand-drawn);
    # `images.list(min_confidence_lt=...)` filters by it for a review queue. None for
    # images saved before it was recorded.
    min_confidence: float | None = None
    # File size in bytes.
    file_size: int = 0
    # Width in pixels; None if unknown.
    width: int | None = None
    # Height in pixels; None if unknown.
    height: int | None = None
    # Stored MIME type, e.g. 'image/png'.
    content_type: str | None = None
    # Its directory in the dataset (`/` for the root).
    directory_path: str | None = None
    # Tags set by people (`images.bulk_tag` writes them), not auto-tags.
    tags: list[str] = []
    # True when archived; delete with `permanent=True` to remove it for good.
    is_archived: bool = False
    # URL of the full image; fetching it needs your X-API-Key (`images.download` saves
    # it to disk).
    image_url: str | None = None
    # CDN URL of a thumbnail, about 200 px.
    thumbnail_url: str | None = None
    # API URL of its annotations, as JSON.
    annotation_url: str | None = None
    created_at: datetime

    # The image's address in its dataset - pass it as `image` to any per-image call.
    @property
    def path(self) -> str: ...

min_confidence is the image’s lowest annotation confidence (1.0 for a person’s); tags are set with bulk_tag. Its annotations: annotations.get.

upload

Upload a local image; the bytes go straight to storage. A name already in the directory, live or archived, is a 409. Supported: .jpg, .jpeg, .png, .webp, .bmp, .tif, .tiff, .gif and .heic (stored as PNG); an SVG is a 400.

Source: Images.upload

Arg Type Default Notes
dataset str required Dataset name or id
file_path str | Path required Local file
directory str "/" Destination directory, e.g. /cars
filename str | None None Name in the dataset (default: the file’s)
content_type str | None None MIME type (default: from the extension)
progress Callable[[int, int], None] | None None Called with (bytes_sent, total_bytes)
from pathlib import Path

image = client.images.upload(
    dataset="road-signs",
    file_path=Path("./photo.jpg"),
    directory="/cars",
)
print(image.id, image.filename, image.directory_path)
pictograph images upload road-signs ./photo.jpg --directory /cars
# Step 1 - request a signed upload URL.
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/upload-url" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "road-signs",
    "filename": "photo.jpg",
    "directory": "/cars",
    "content_type": "image/jpeg"
  }'

# Step 2 - PUT the raw bytes to the returned upload_url (no API key on that URL).
curl -s -X PUT "<upload_url>" \
  -H "Content-Type: image/jpeg" \
  --upload-file ./photo.jpg

# Step 3 - register it, with the same fields as step 1.
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/register" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "road-signs",
    "filename": "photo.jpg",
    "directory": "/cars",
    "file_size": 123456,
    "content_type": "image/jpeg",
    "width": 1920,
    "height": 1080
  }'

Register returns the Image. POST /upload does all three steps in one request:

curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/upload" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -F "dataset=road-signs" \
  -F "directory=/cars" \
  -F "file=@./photo.jpg"

Returns Image

Image · 18 fields
class Image(BaseModel):
    """An image within a Pictograph dataset."""
    id: str
    # Its dataset's id.
    dataset_id: str | None = None
    filename: str
    # Its labeling stage.
    status: Literal['new', 'annotate', 'review', 'complete'] = 'new'
    # train, val or test; None if unassigned.
    split: Optional[Literal['train', 'val', 'test']] = None
    annotation_count: int = 0
    # The lowest confidence among its annotations, 0 to 1 (1.0 for hand-drawn);
    # `images.list(min_confidence_lt=...)` filters by it for a review queue. None for
    # images saved before it was recorded.
    min_confidence: float | None = None
    # File size in bytes.
    file_size: int = 0
    # Width in pixels; None if unknown.
    width: int | None = None
    # Height in pixels; None if unknown.
    height: int | None = None
    # Stored MIME type, e.g. 'image/png'.
    content_type: str | None = None
    # Its directory in the dataset (`/` for the root).
    directory_path: str | None = None
    # Tags set by people (`images.bulk_tag` writes them), not auto-tags.
    tags: list[str] = []
    # True when archived; delete with `permanent=True` to remove it for good.
    is_archived: bool = False
    # URL of the full image; fetching it needs your X-API-Key (`images.download` saves
    # it to disk).
    image_url: str | None = None
    # CDN URL of a thumbnail, about 200 px.
    thumbnail_url: str | None = None
    # API URL of its annotations, as JSON.
    annotation_url: str | None = None
    created_at: datetime

    # The image's address in its dataset - pass it as `image` to any per-image call.
    @property
    def path(self) -> str: ...

bulk_upload

Upload up to 500 files to one directory. A name already there, or repeated in the call, is skipped and listed in failed. annotations imports labels too; embed=False skips embedding and auto-tagging, to run later with datasets.backfill_embeddings.

Source: Images.bulk_upload

Arg Type Default Notes
dataset str required Dataset name or id
file_paths Sequence[str | Path] required Local files, up to 500
directory str "/" Destination directory for all files
max_workers int 8 Files uploaded at once
progress Callable[[int, int], None] | None None Called with (done, total)
annotations Sequence[Sequence[Annotation]] | None None One annotation list per file, in file_paths order
embed bool True False skips embedding and auto-tagging
result = client.images.bulk_upload(
    dataset="road-signs",
    file_paths=["a.jpg", "b.jpg"],
    directory="/",
)
print(result.count, "registered,", len(result.failed), "failed")
for img in result.succeeded:
    print(img.filename, img.id, img.status)
pictograph images bulk-upload road-signs ./a.jpg ./b.jpg --directory /
# Step 1 - request signed upload URLs for the whole batch, in request order. A name
# the directory already holds (or the request repeats) comes back with
# "upload_url": null and an "error": skip it.
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/bulk-upload-url" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "road-signs",
    "images": [
      {"filename": "a.jpg", "directory": "/", "content_type": "image/jpeg"},
      {"filename": "b.jpg", "directory": "/", "content_type": "image/jpeg"}
    ]
  }'

# Step 2 - PUT each file's bytes to its returned upload_url.
curl -s -X PUT "<upload_url_for_a>" -H "Content-Type: image/jpeg" --upload-file ./a.jpg

# Step 3 - register the uploaded blobs in one call.
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/bulk-register" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "road-signs",
    "images": [
      {"filename": "a.jpg", "directory": "/", "file_size": 12345,
       "content_type": "image/jpeg", "width": 640, "height": 480},
      {"filename": "b.jpg", "directory": "/", "file_size": 23456,
       "content_type": "image/jpeg", "width": 800, "height": 600}
    ]
  }'

Returns BulkUploadResult

BulkUploadResult · 2 fields
class BulkUploadResult(BaseModel):
    """Outcome of Images.bulk_upload."""
    succeeded: list[Image]
    failed: list[BulkUploadFailure]

    # Number of files successfully uploaded + registered.
    @property
    def count(self) -> int: ...

REST returns {"data": {"succeeded": [...], "failed": [...], "count": N}}; each skipped file is {filename, directory_path, error}.

upload_from_directory

Upload a local folder and its subfolders, creating the dataset if it doesn’t exist; a rerun skips what’s already there. Where each file lands: upload guide.

Source: Images.upload_from_directory

Arg Type Default Notes
dataset str required Dataset name or id
source_path str | Path required Local folder
organize_by_class bool True The first folder level becomes the directory; False puts every file at the root
preserve_structure bool False Keep the whole folder tree
max_workers int 8 Files uploaded at once
skip_existing bool True Skip names already in the dataset; False lists them as failures
create_if_missing bool True Create the dataset if it doesn’t exist
progress Callable[[int, int, str | None], None] | None None Called with (done, total, filename)
report = client.images.upload_from_directory(
    dataset="road-signs",
    source_path="./photos",
    organize_by_class=True,
    max_workers=8,
)
print(report.images_uploaded, len(report.failures))
pictograph images upload-directory road-signs ./photos --by-class --workers 8
# It uploads in batches of up to 500 with bulk-upload-url and bulk-register (see bulk_upload).
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/bulk-upload-url" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dataset": "road-signs",
    "images": [
      {"filename": "a.jpg", "directory": "/cars", "content_type": "image/jpeg"},
      {"filename": "b.jpg", "directory": "/cars", "content_type": "image/jpeg"}
    ]
  }'

Returns UploadReport

UploadReport · 5 fields
class UploadReport(BaseModel):
    """Outcome of an Images.upload_from_directory call."""
    dataset_name: str
    images_attempted: int = 0
    images_uploaded: int = 0
    images_skipped: int = 0
    failures: list[UploadFailure] = []

    @property
    def success(self) -> bool: ...

download

Download an image’s original file, written only once complete.

Source: Images.download

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
output_path str | Path required Where to write it; missing folders are created
chunk_size int 8388608 Bytes per download chunk
client.images.download(
    dataset="road-signs",
    image="stop-sign-0421.jpg",
    output_path="./photo.jpg",
)
pictograph images download road-signs stop-sign-0421.jpg --output ./photo.jpg
curl -s "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -o ./photo.jpg

Returns Path

download_bundle

Download an image’s data as a zip: the original, its depth map if any, its annotations as Pictograph JSON, and a manifest.json of what’s inside.

Source: Images.download_bundle

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
output_path str | Path required Where to write it; missing folders are created
chunk_size int 8388608 Bytes per download chunk
client.images.download_bundle(
    dataset="road-signs",
    image="stop-sign-0421.jpg",
    output_path="./stop-sign-0421.zip",
)
pictograph images download-bundle "road-signs" stop-sign-0421.jpg
curl -s "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg/data-bundle" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -o ./stop-sign-0421.zip

Returns Path

The CLI writes ./<image name>.zip unless you pass --output.

delete

Archive an image (it can be restored); permanent=True deletes it for good and needs an admin key.

Source: Images.delete

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
permanent bool False Delete permanently instead of archiving
client.images.delete(
    dataset="road-signs",
    image="stop-sign-0421.jpg",
)

client.images.delete(
    dataset="road-signs",
    image="stop-sign-0421.jpg",
    permanent=True,
)
pictograph images delete road-signs stop-sign-0421.jpg --yes               # archive
pictograph images delete road-signs stop-sign-0421.jpg --permanent --yes   # for good
# Archive (recoverable)
curl -s -X DELETE "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

# Permanent (irreversible, admin+ role)
curl -s -X DELETE "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg?permanent=true" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns None

A permanent delete leaves imported copies in other datasets intact.

review

Approve an image, or send it back with a note for the annotator. Needs a member key.

Source: Images.review

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
action Literal["approve", "request_changes"] required approve marks the image complete; request_changes returns it for annotation
note str | None None Note for the annotator, with request_changes
# Approve - accept the annotations, mark complete
client.images.review(
    dataset="road-signs",
    image="stop-sign-0421.jpg",
    action="approve",
)

# Request changes - send back to the annotator with a note
client.images.review(
    dataset="road-signs",
    image="stop-sign-0422.jpg",
    action="request_changes",
    note="tighten the left car bbox",
)

# QA loop: bounce every low-confidence image for a human to fix
for img in client.images.iter(dataset="road-signs", min_confidence_lt=0.6):
    client.images.review(
        dataset="road-signs",
        image=img.path,
        action="request_changes",
        note="model unsure - please verify",
    )
pictograph images review road-signs stop-sign-0421.jpg
pictograph images review road-signs stop-sign-0422.jpg \
  --request-changes --note "tighten the left car bbox"
# Approve
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg/review" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"action": "approve"}'

# Request changes with a note
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0422.jpg/review" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"action": "request_changes", "note": "tighten the left car bbox"}'

Returns ImageStatus

ImageStatus
ImageStatus = Literal['new', 'annotate', 'review', 'complete']

set_split

Put one image in the train, val or test split, or take it out (split=None). For a whole dataset, use assign_splits.

Source: Images.set_split

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
split ImageSplit | None required train, val, test, or None to remove it
client.images.set_split(
    dataset="road-signs",
    image="stop-sign-0421.jpg",
    split="test",
)

client.images.set_split(
    dataset="road-signs",
    image="stop-sign-0421.jpg",
    split=None,
)

# Read a partition back
train = client.images.iter(dataset="road-signs", split="train").all()
pictograph images split road-signs stop-sign-0421.jpg test
pictograph images split road-signs stop-sign-0421.jpg none
pictograph images list road-signs --split train
# Assign
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg/split" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"split": "test"}'

# Clear
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/road-signs/train/stop-sign-0421.jpg/split" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"split": null}'

# Filter a dataset by split
curl -s "https://api.pictograph.io/api/v1/developer/images/?dataset=road-signs&split=train" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns ImageSplit | None

ImageSplit
ImageSplit = Literal['train', 'val', 'test']

assign_splits

Split the dataset (archived images aside) into train, val and test by percent. Omitted percentages use the dataset’s saved ones, else 70 / 20 / 10; the same seed gives the same split. Needs a member key.

Source: Images.assign_splits

Arg Type Default Notes
dataset str required Dataset name or id
train int | None None Percent in train
val int | None None Percent in val
test int | None None Percent in test
seed int 42 Shuffle seed
mode Literal["random", "embedding"] "random" embedding splits within each embedding-map cluster so every visual group reaches all three splits (409 without a map), and the result adds cluster counts
counts = client.images.assign_splits(
    dataset="road-signs",
    train=70,
    val=20,
    test=10,
)
print(counts)
pictograph images rebalance road-signs --train 80 --val 10 --test 10 --mode embedding
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/assign-splits" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "train": 70, "val": 20, "test": 10, "seed": 42}'

Returns dict[str, int]

A call that fails part-way can be repeated: the same arguments finish the same split.

bulk_tag

Add or remove tags on many images. Returns how many changed.

Source: Images.bulk_tag

Arg Type Default Notes
dataset str required Dataset name or id
images Sequence[str] required Image ids
tags Sequence[str] required Tags to add or remove
add bool True False removes the tags instead
reviewed = client.images.iter(dataset="road-signs", status="complete").all()

n = client.images.bulk_tag(
    dataset="road-signs",
    images=[i.id for i in reviewed],
    tags=["reviewed"],
)
print(n, "images tagged")

client.images.bulk_tag(
    dataset="road-signs",
    images=[i.id for i in reviewed],
    tags=["blurry"],
    add=False,
)
# Image ids, not names. --tag repeats.
pictograph images tag road-signs \
  3f1c8e42-6b90-4a71-9d0e-2b5c7a11e004 \
  9a2d5b17-4c83-4f60-8e11-6d7f0c93a221 \
  --tag reviewed

# --remove strips the same tags instead
pictograph images tag road-signs \
  3f1c8e42-6b90-4a71-9d0e-2b5c7a11e004 \
  --tag blurry --remove
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/bulk-tag" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "dataset": "road-signs",
        "images": ["3f1c8e42-6b90-4a71-9d0e-2b5c7a11e004"],
        "tags": ["reviewed"],
        "add": true
      }'

Returns int

augment

Make multiplier augmented copies of each image, annotations moved to match, made locally and uploaded (ops).

Source: Images.augment

Arg Type Default Notes
dataset str required Dataset name or id
ops Sequence[Augmentation] required Ops from pictograph.augment, applied in order
multiplier int 3 Copies per image (at least 1)
into str | None None Output dataset, created with the source’s classes if missing; None writes to the source
include_original bool True Also copy the originals into into
directory str "/augmented" Destination directory
seed int | None None Seed for repeatable copies
max_source_images int | None None Augment at most this many images (for a quick trial)
jpeg_quality int 95 JPEG quality, 1 to 100
drop_classes Iterable[str] | None None Classes to remove first, from annotations and from a new dataset’s class list
skip_empty bool False Skip an image left with no annotations (counted in skipped_empty)
on_progress Callable[[int, int], None] | None None Called with (done, total) after each image
from pictograph.augment import Brightness, HorizontalFlip

report = client.images.augment(
    dataset="road-signs",
    ops=[HorizontalFlip(), Brightness(0.2)],
    multiplier=3,
    into="road-signs-augmented",
)
print(report.variants_created, "variants from", report.source_images, "images")
pictograph augment dataset road-signs --into road-signs-aug
# No endpoint of its own: it makes each copy locally, then uploads it and saves its annotations.
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/upload" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -F "dataset=road-signs" -F "directory=/augmented" -F "file=@variant.jpg"

curl -s -X POST "https://api.pictograph.io/api/v1/developer/annotations/bulk" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "saves": [{"image": "augmented/variant.jpg", "annotations": []}]}'

Returns AugmentReport

AugmentReport · 8 fields
class AugmentReport(BaseModel):
    """Outcome of an Images.augment run."""
    source: str
    target: str
    source_images: int = 0
    originals_copied: int = 0
    variants_created: int = 0
    annotations_written: int = 0
    skipped_empty: int = 0
    failures: list[AugmentFailure] = []

    @property
    def success(self) -> bool: ...

tile

Cut each image into a rows by cols grid of tiles, annotations clipped to each, made locally and uploaded.

Source: Images.tile

Arg Type Default Notes
dataset str required Dataset name or id
rows int 2 Rows of tiles, at least 1
cols int 2 Columns of tiles, at least 1
overlap float 0.0 Fraction each tile extends into its neighbors, from 0 to under 0.9
min_visibility float 0.1 Drop an annotation from a tile when less than this fraction of its area is inside
include_empty bool True False skips tiles with no annotations
into str | None None As in augment
directory str "/tiles" Destination directory
max_source_images int | None None Tile at most this many images
jpeg_quality int 95 JPEG quality, 1 to 100
on_progress Callable[[int, int], None] | None None Called with (done, total) after each image
report = client.images.tile(
    dataset="aerial",
    rows=2,
    cols=2,
    overlap=0.1,
    into="aerial-tiled",
)
print(report.tiles_created, "tiles;", report.annotations_written, "annotations")
pictograph tile dataset road-signs --into road-signs-tiled --rows 2
# No endpoint of its own: it cuts each tile locally, then uploads it and saves its annotations.
curl -s -X POST "https://api.pictograph.io/api/v1/developer/images/upload" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -F "dataset=road-signs" -F "directory=/tiles" -F "file=@tile.jpg"

curl -s -X POST "https://api.pictograph.io/api/v1/developer/annotations/bulk" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "saves": [{"image": "tiles/tile.jpg", "annotations": []}]}'

Returns TileReport

TileReport · 7 fields
class TileReport(BaseModel):
    """Outcome of an Images.tile run."""
    source: str
    target: str
    source_images: int = 0
    tiles_created: int = 0
    empty_tiles: int = 0
    annotations_written: int = 0
    failures: list[TileFailure] = []

    @property
    def success(self) -> bool: ...

Common errors

Status Exception Cause
400 ValidationError A filename or directory that isn’t allowed, or a file that isn’t an image (an SVG, for one)
403 ForbiddenError A key below member (upload, review, split) or admin (permanent delete)
404 NotFoundError The image or dataset doesn’t exist; for a bare filename not at the root, the error names the path to use
409 ConflictError The directory already holds an image of that name
Copied to clipboard