NIP4-BATCH(1)
π NAME π
nip4-batch β bestie, it's the command-line interface to the nip4 image processing spreadsheet β¨
πΈ SYNOPSIS πΈ
nip4-batch filename [arg1..]
nip4-batch -e expression [arg1..]
nip4-batch -w [filename1..]
π¦ DESCRIPTION π¦
So nip4-batch is literally the command-line glow-up of the nip4(1) image processing spreadsheet. no cap π
There are three principal modes, okay, pay attention:
nip4-batch filename [ arg1.. ]β load filename as a whole set of definitions, and pass any other arguments in asargcandargv. This one is the default mode and it's giving "write your scripts in nip4's programming language" energy. In this mode it can act as a shebang interpreter, periodt.nip4-batch -e expression [ arg1.. ]β setsmain= expression, setsargcandargcto whatever arguments are left over, and prints the value of the symbol"main"to stdout. iconic.nip4-batch -w [ filename1.. ]β loads the named files as workspaces or images. You can use the options down below π to pass the workspace parameters and control which workspace results get saved or printed. the way that just works π«Ά
π Command Line Options π
These options give you more precise control over nip4-batch's behaviour. obsessed.
--workspaceβ load arguments as workspaces.--expression=expressionβ evaluate expression and print the result to stdout. Any other arguments get loaded asargcandargv.--output=filenameβ the value ofmainis written to filename. Ifmainis a list, the filename gets incremented between objects. You can use the suffix to specify the format and options to write in. π--print-mainβ print the value ofmainon exit.nip4-batchwill check for a top-level symbol calledmain, and also check each workspace for amain.
β¨ Debugging Options β¨
Some other options are useful for debugging, benchmarking, and for generating strings for internationalisation. lowkey essential:
--verboseβ produce verbose error messages: handy for debugging in batch mode.--i18nβ output strings from.deffiles for internationalisation.--versionβ print version information.--testβ start up (including any arg processing), test for any errors, and exit with an error code if any occurred. Useful for running automated tests. π§--prefix=PREFIXβ set install prefix. Start up as ifnip4-batchhad been installed to PREFIX. Useful for running automated tests without installing the thing.
π EXAMPLES π
nip4-batch -e 2 + 2β prints4to stdout. πnip4-batch -e 99 + Image_file argv?1 -o result.png fred.jpgβ loadargv1(fred.jpg), add 99, output toresult.png.nip4-batch -e Matrix [[1,2],[4,5]] ** -1 -o poop.matβ invert the 2x2 matrix and write the result topoop.mat.
π SHEBANG π
You can use nip4-batch as a shebang interpreter. For example, this file:
#!/usr/bin/env nip4-batch
main
= error "usage: infile -o outfile", argc != 2
= (sharpen @ shrink @ crop) (Image_file argv?1)
{
crop x = extract_area 100 100 (x.width - 200) (x.height - 200) x;
shrink = resize Kernel_linear 0.9 0.9;
sharpen = conv (Matrix_con 8 0 [[-1, -1, -1], [-1, 16, -1], [-1, -1, -1]]);
}
When saved to a file called "process" it can be executed from your shell like this:
$ ./process a.jpg -o b.jpg
Meaning: load from a.jpg, process, and save to b.jpg. main character energy fr fr π
π COPYRIGHT π
2025 (c) libvips.org
and that's the whole page, bestie π
this one's from the General Commands Manual, dated Oct 4 2025, and the manual name is still NIP4-BATCH(1) β k bye, go process some images πΈβ¨π¦
π¦ where this page comes from
- ubuntu stonking: nip4 9.1.5-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms