Lathe

v0.4.1
io.github.seayniclabs/lathe Checked 1 day ago Published 1 month ago

Local 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).

ParameterTypeDescription
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.

ParameterTypeDescription
input_path *string
output_path *string
height
overwriteboolean
percentage
width

image_convert

Convert an image to png, jpeg, webp, avif or bmp. The output extension must match.

ParameterTypeDescription
format *string
input_path *string
output_path *string
overwriteboolean

image_optimize

Shrink an image for web delivery. Metadata is stripped unless strip_metadata=false.

ParameterTypeDescription
input_path *string
output_path *string
overwriteboolean
qualityinteger
strip_metadataboolean

image_crop

Crop a rectangle from an image. x and y are pixels from the top-left corner.

ParameterTypeDescription
height *integer
input_path *string
output_path *string
width *integer
x *integer
y *integer
overwriteboolean

image_thumbnail

Make a thumbnail that fits inside a square of the given size, keeping the aspect ratio.

ParameterTypeDescription
input_path *string
output_path *string
overwriteboolean
sizeinteger

pdf_info

PDF metadata: page count, file size, encryption, title, author and creator.

ParameterTypeDescription
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.

ParameterTypeDescription
input_path *string
max_charsinteger
ocr_fallbackboolean
offsetinteger
pages

pdf_merge

Merge several PDFs, in the order given, into one new PDF.

ParameterTypeDescription
input_paths *array
output_path *string
overwriteboolean

pdf_to_images

Render PDF pages to PNG or JPEG files in a folder, at a chosen DPI. Needs ghostscript.

ParameterTypeDescription
input_path *string
output_dir *string
dpiinteger
formatstring
overwriteboolean
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.

ParameterTypeDescription
input_path *string
output_dir *string
overwriteboolean
pages_per_fileinteger

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.

ParameterTypeDescription
input_path *string
output_path *string
overwriteboolean

audio_info

Audio metadata: duration, format, bitrate, sample rate, channels and codec.

ParameterTypeDescription
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.

ParameterTypeDescription
format *string
input_path *string
output_path *string
overwriteboolean

video_info

Video metadata: duration, resolution, codec, frame rate, bitrate and audio tracks.

ParameterTypeDescription
input_path *string

video_thumbnail

Save one frame of a video as a PNG or JPEG, at a time in seconds.

ParameterTypeDescription
input_path *string
output_path *string
overwriteboolean
timestampnumber

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.

ParameterTypeDescription
input_path *string
output_path *string
end
overwriteboolean
startnumber

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.

ParameterTypeDescription
input_path *string
output_path *string
durationnumber
fpsinteger
overwriteboolean
startnumber
widthinteger

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.

ParameterTypeDescription
input_path *string
lang
max_charsinteger
offsetinteger

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.

ParameterTypeDescription
module