Sunday, November 08, 2026

Linux CLI ~ just the commands

Reverting back to an earlier, cleaner list of Linux CLI image processing commands that I find useful.  These are added to as more commands are tried and verified.

Linux Command Line Interface - 

Note: For some reason when installing a new version of Linux the imagemagic ./config... showed no jpg support.  A sudo apt-get install libjpeg-dev command was required.  Similarly, libpng-dev, libtiff-dev and other image file formats seem to be missing from the build I was trying to make and needed to explicitly be found and included. 

 

Magick commands - 

magick some_image.png Hald_CLUT_x.png -hald-clut result_image.jpg - Takes a base image and applies a 4k by 4k LUT from the command line, requires Imagemagick v7+.  Built by hand on MintOS Linux as this version isn't yet available from a software repository.  

magick -background transparent *.JPG -resize "1600x1600>" -gravity center -extent 2000x2000 -evaluate-sequence mean averaged_image_output.jpg - Image averaging command where the frame size is set by -extent in this example to 2000x2000 pixels and input files are -resized on the long dimension to 1600

magick -background transparent *.JPG -rotate "90>"  -resize "1600x1600>" -gravity center -extent 2000x2000 -evaluate-sequence mean averaged_image_output.jpg - Same as above, except this rotates images to align horizontal and vertical.

magick *.JPG -gravity center -evaluate-sequence mean -level x%,xx% -sigmoidal-contrast y,yy% outputfilename.jpg - Resizing nothing and taking the image files as they come, no reorientation, "-level" added where the first number pulled the black level to the right and the second number sets the white level.  Added "-sidmoidal-contrast" that adds an "S shaped contrast curve" where the first number is also the moving of the black level to the right and the second number defines the steepness of the contrast curve.


Mogrify commands - takes a blob of files and outputs either in place or to something specific

mogrify -format jpg *.png - change file format from png to jpg

mogrify -resize 1920 *.jpg – resizing command

mogrify -bordercolor black -border 10x10 *.jpg – adding a thin black edge to images

mogrify -bordercolor white -border 400x400 *.jpg – adding a white border to images

magick image1.jpg image2.jpg +append output.jpg - place two images side by side left to right

 

Bash scripts - for taking a blob of files and outputting to specified name prefix blob

With magick we can use a Bash script to CLUT sample colorize a batch of images as follows...

for i in *.JPG; do magick "$i" Hald_CLUT_4kx4k.png -hald-clut "Tinted$i"; done - Takes a HaldCLUT and applies colors/tints to multiple files while renaming the output so as to not collide with the original images

for i in *.jpg; do magick "$i" -colorspace Gray  "BW_$i"; done – Bash script to convert a bunch of files into black and white updated from depricated "convert" command

for i in *.jpg; do convert "$i" -colorspace Gray  "BW_$i"; done – Bash script to convert a bunch of files into black and white

for i in {0..xxxx..x00}; do magick "inputfilename.jpg" -crop Xdimension_x_Ydimension+0+$i +repage "OutputFilename$i.jpg"; done - A bash script to sectional slice an image file 

 

Gmic Commands -

gmic -input <filename.file-extension> scale_dcci2x , cut 0,255 round output <theOutputFileName>.<fileExtension> - command to perform a DCCI2x upsize - on Linux or Android "termux", where <fileExtension> can be .tif or .jpg, etc

----------- other commands -----------

exiftool -a -u -s -G1 <file_name> - to read EXIF image file data

LibreOffice : Impress

  • menu Insert | Media | Photo Album :: Slide Layout 

No comments: