FitFileSize

v0.3.0
io.github.Gautamstar/fitfilesize Checked 5 hours ago Published 7 days ago

Compress PDFs and images, iPhone HEIC too, to fit an upload limit or a form's rules.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

fit_file Fit files under an upload limit

Compress a PDF or image (JPEG, PNG, WebP, TIFF, BMP, or an iPhone HEIC photo, which comes back as a JPEG) on this computer so it fits an upload limit, keeping as much quality as the limit allows, and save the result next to the original as "<name>.fit.<ext>". Give `path` for one file or `paths` for up to 10 that share the same limit. Give either `limit` (like "200KB" or "1.5MB"; KB and MB are 1000-based, so the file passes a check done either way) or `form` (a form preset from list_forms, like "ibps-signature" or "us-visa-photo-ds160", which sets the limit, minimum size and exact pixels that f…

ParameterTypeDescription
fitstringWhen width and height change the shape: "crop" to fill (default) or "pad" with white.
formstringA form preset id or name from list_forms, like "ibps-photo". Use this or `limit`.
heightintegerExact height in pixels (images only).
jpeg_okbooleanLet a PNG, WebP, TIFF or BMP come back as a JPEG when that is what fits. Only if the upload accepts JPEG; by default every file keeps its format.
limitstringUpload limit, like "200KB", "50 KB" or "1.5MB". Use this or `form`.
minimumstringSmallest allowed size, like "10KB", for forms that set one. A small JPEG is padded up to it.
outputstringWhere to save the result, with `path` only. Defaults to "<name>.fit.<ext>" beside the original.
pathstringFull path to the file on this computer ("~/" is allowed). Use this or `paths`.
pathsarrayFull paths to several files that share the same limit, up to 10. Use this or `path`.
widthintegerExact width in pixels (images only).

list_forms List form presets

The upload forms FitFileSize has presets for (visa photos, Indian exam and bank applications, and more), each with its size limit, minimum and pixel size, and the official source of those rules. Pass an id to fit_file as `form`.