NIP4-BATCH(1)

πŸ“¦ version 9.1.5, in ubuntu stonking

πŸ’– 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 as argc and argv. 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.. ] β€” sets main = expression, sets argc and argc to 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 as argc and argv.
  • --output=filename β€” the value of main is written to filename. If main is 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 of main on exit. nip4-batch will check for a top-level symbol called main, and also check each workspace for a main.

✨ 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 .def files 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 if nip4-batch had been installed to PREFIX. Useful for running automated tests without installing the thing.

🌈 EXAMPLES 🌈

  • nip4-batch -e 2 + 2 β€” prints 4 to stdout. πŸ“
  • nip4-batch -e 99 + Image_file argv?1 -o result.png fred.jpg β€” load argv1 (fred.jpg), add 99, output to result.png.
  • nip4-batch -e Matrix [[1,2],[4,5]] ** -1 -o poop.mat β€” invert the 2x2 matrix and write the result to poop.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 πŸ’–


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