Lathe
v0.4.1Local file and media tools: images, PDF, audio, video, OCR, batch and metadata.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
image_info
Image metadata: width, height, format, mode, file size, and EXIF tags (capped).
| Parameter | Type | Description |
|---|---|---|
input_path * | string |
image_resize
Resize an image by width, height, or percentage. Keeps the aspect ratio when only one dimension is given. Output format comes from the output extension.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_path * | string | |
height | ||
overwrite | boolean | |
percentage | ||
width |
image_convert
Convert an image to png, jpeg, webp, avif or bmp. The output extension must match.
| Parameter | Type | Description |
|---|---|---|
format * | string | |
input_path * | string | |
output_path * | string | |
overwrite | boolean |
image_optimize
Shrink an image for web delivery. Metadata is stripped unless strip_metadata=false.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_path * | string | |
overwrite | boolean | |
quality | integer | |
strip_metadata | boolean |
image_crop
Crop a rectangle from an image. x and y are pixels from the top-left corner.
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
input_path * | string | |
output_path * | string | |
width * | integer | |
x * | integer | |
y * | integer | |
overwrite | boolean |
image_thumbnail
Make a thumbnail that fits inside a square of the given size, keeping the aspect ratio.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_path * | string | |
overwrite | boolean | |
size | integer |
pdf_info
PDF metadata: page count, file size, encryption, title, author and creator.
| Parameter | Type | Description |
|---|---|---|
input_path * | string |
pdf_extract_text
Extract text from a PDF, or from some pages ("2-5"). Pages with no text layer are read with OCR when it is installed. Long text comes in parts: pass next_offset as offset to continue.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
max_chars | integer | |
ocr_fallback | boolean | |
offset | integer | |
pages |
pdf_merge
Merge several PDFs, in the order given, into one new PDF.
| Parameter | Type | Description |
|---|---|---|
input_paths * | array | |
output_path * | string | |
overwrite | boolean |
pdf_to_images
Render PDF pages to PNG or JPEG files in a folder, at a chosen DPI. Needs ghostscript.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_dir * | string | |
dpi | integer | |
format | string | |
overwrite | boolean | |
pages |
pdf_split
Split a PDF into parts of N pages each. Writes new PDFs into a folder and never overwrites one unless overwrite=true.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_dir * | string | |
overwrite | boolean | |
pages_per_file | integer |
pdf_compress
Write a smaller copy of a PDF. Lossless: it recompresses content streams and removes duplicate objects; images are not re-encoded. Writes one new file; never overwrites unless overwrite=true.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_path * | string | |
overwrite | boolean |
audio_info
Audio metadata: duration, format, bitrate, sample rate, channels and codec.
| Parameter | Type | Description |
|---|---|---|
input_path * | string |
audio_convert
Convert audio to mp3, wav, flac, aac or ogg. A video input keeps only its audio. The output extension must match the format.
| Parameter | Type | Description |
|---|---|---|
format * | string | |
input_path * | string | |
output_path * | string | |
overwrite | boolean |
video_info
Video metadata: duration, resolution, codec, frame rate, bitrate and audio tracks.
| Parameter | Type | Description |
|---|---|---|
input_path * | string |
video_thumbnail
Save one frame of a video as a PNG or JPEG, at a time in seconds.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_path * | string | |
overwrite | boolean | |
timestamp | number |
video_trim
Cut a section out of a video into a new file (stream copy, so it is fast and lossless; cuts land on keyframes). Never overwrites unless overwrite=true.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_path * | string | |
end | ||
overwrite | boolean | |
start | number |
video_to_gif
Make an animated GIF from part of a video (up to 30 seconds, palette-optimized). Writes one new file; never overwrites unless overwrite=true.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
output_path * | string | |
duration | number | |
fps | integer | |
overwrite | boolean | |
start | number | |
width | integer |
ocr_image
Extract the text from an image with OCR. Long text comes in parts: pass next_offset as offset to continue. lang overrides LATHE_OCR_LANG.
| Parameter | Type | Description |
|---|---|---|
input_path * | string | |
lang | ||
max_chars | integer | |
offset | integer |
health
Server status, version, working directory, and whether each external piece is installed.
lathe_modules
Which modules are on, which pieces are missing (with the install command), and what each tool does. Pass a module name for its settings too.
| Parameter | Type | Description |
|---|---|---|
module |