---
type: Attested Computation
title: transform
identifier: image/transform
description: Resize, crop, convert, and compress images (PNG, JPEG, WebP, GIF, TIFF, BMP), reporting the byte savings on stdout. Set max_dimension to fit the longest edge inside a box while preserving aspect ratio, or give width and/or height directly; crop takes "x,y,w,h" in pixels and is applied before any resize. Shrinks oversized screenshots before they consume an agent's context or get embedded in a PDF.
pack: image
tags:
- media
runtime: fragletc
image: ofthemachine/python3@sha256:a015b4f9f0e7c1648f8fcd4164f6a296dd3c9189404f88f333a9764d08d13522
network: none
stdin: none
execution_class: hermetic
procedure_hash: sha256:66606990e1aec01379992222a56644b0e8c46f95effd1b4139783a07b3738e85
parameters:
- name: image
  type: file
  required: true
  description: Source image mounted at /input/image
- name: max_dimension
  type: string
  required: false
  description: Fit longest edge inside this many pixels
- name: width
  type: string
  required: false
  description: Target width in pixels
- name: height
  type: string
  required: false
  description: Target height in pixels
- name: crop
  type: string
  required: false
  description: Crop box as x,y,w,h in pixels (before resize)
- name: format
  type: string
  required: false
  description: Output format (PNG, JPEG, WEBP, …); default keeps source
- name: quality
  type: string
  required: false
  default: '85'
  description: JPEG/WebP quality 1-100
- name: grayscale
  type: string
  required: false
  default: 'false'
  description: Convert to grayscale when true
computation: https://tools.ofthemachine.com/image/transform.py
executor:
  resource: https://github.com/ofthemachine/fraglet
  receipt:
  - schema
  - fragletc
  - procedure
  - procedure_hash
  - image
  - image_digest
  - network
  - stdin_mode
  - params
  - inputs
  - argv
  - env
  - memo_key
  - started
  - finished
  - exit_code
  - stdout
  - outputs
  format: fraglet-receipt/2 (fragletc --receipt <path>, or FRAGLETC_RECEIPT_DIR)
attester:
  resource: https://tools.ofthemachine.com/receipt/attest.py
  method: 'deterministic, no re-execution: procedure_hash equals sha256 of computation; memo_key recomputes from the receipt''s own fields; claimed params and any artifact hash match the receipt'
generated:
  by: process:tools/catalog/compile.py
  at: '2026-11-13T18:27:40Z'
outputs:
- image
---

# transform

Resize, crop, convert, and compress images (PNG, JPEG, WebP, GIF, TIFF, BMP), reporting the byte savings on stdout. Set max_dimension to fit the longest edge inside a box while preserving aspect ratio, or give width and/or height directly; crop takes "x,y,w,h" in pixels and is applied before any resize. Shrinks oversized screenshots before they consume an agent's context or get embedded in a PDF.

Use when an image must be resized, cropped, converted to another format, or compressed to a smaller file size.

# Schema

## Parameters
- `image` (file, required) — Source image mounted at /input/image
- `max_dimension` (string, optional) — Fit longest edge inside this many pixels
- `width` (string, optional) — Target width in pixels
- `height` (string, optional) — Target height in pixels
- `crop` (string, optional) — Crop box as x,y,w,h in pixels (before resize)
- `format` (string, optional) — Output format (PNG, JPEG, WEBP, …); default keeps source
- `quality` (string, optional, default `85`) — JPEG/WebP quality 1-100
- `grayscale` (string, optional, default `false`) — Convert to grayscale when true

## Outputs
- `image` (declared file under /output)

# Execution

The computation is [`image/transform.py`](https://tools.ofthemachine.com/image/transform.py) (frontmatter `computation`; in `tools.tar.gz` the same file sits at `image/transform.py` beside this bundle), run by `fragletc` in `ofthemachine/python3@sha256:a015b4f9f0e7c1648f8fcd4164f6a296dd3c9189404f88f333a9764d08d13522` with network `none`. Its identity is `procedure_hash` = sha256 of that file, shebang included — the same value every receipt records. Parameters are passed as `-p name=value`; `--receipt run.json` (or `FRAGLETC_RECEIPT_DIR`) writes the receipt, a `fraglet-receipt/2` JSON document with the fields listed under `executor.receipt`.

# Attestation

A run's receipt is attested with [`receipt/attest.py`](https://tools.ofthemachine.com/receipt/attest.py): the computation that ran is this script (`procedure_hash`), the receipt is internally consistent (`memo_key` recomputes from its own fields), the claimed parameters are the ones that ran, and an artifact claimed as an output hashes to what the receipt recorded. No re-execution: attestation is provenance fidelity, not reproduction.

Hermetic: no network, so `memo_key` also fully determines the outputs — a re-run with the same inputs must reproduce them, which makes results from this tool safely memoizable.

Skill: [SKILL.md](https://tools.ofthemachine.com/image/SKILL.md)
