scale up using nearest neighbour interpolation

convert from.png -interpolate Nearest -filter point -resize 800% to.png

create a side by side image:

convert +append  LEFT.jpg RIGHT.jpg COMBI.png

batch set jpg quality to 80%

mogrify -quality 80% *.jpg 

cmyk pdf to rgb jpg sequence

convert -colorspace sRGB input.pdf output/%d.jpg

16bit grayscale to separate 8 bit color channels (with Python)

combine images vertically and create filename with 0's padding


for number in `seq 1 1 370`;


  convert "$folder$input1" "$folder$input2" -clone 0 -delete 0 -gravity North -append $result

unsharp (mask?)

convert INPUT.jpg -unsharp 10x4+1+0 OUTPUT.jpg


convert INPUT.jpg -fill "black" -draw "rectangle 0,440,3000,4200" -draw "rectangle 0,0,3000,180" -draw "rectangle 1870,0,3000,440" ../black/NL-OUTPUT.jpg


convert test.jpg -crop 1870x290+0+150 x.jpg

separate channels to different (grayscale) files

convert rgb.png -separate %d.png

convert 16 bit grayscale to 2x 8 bits channel/file

convert 16_bit_unsigned_int.tif -endian MSB -depth 8 8_bit_hi.png
convert 16_bit_unsigned_int.tif -endian LSB -depth 8 8_bit_lo.png

resize (and replace) to longest axis 2048

mogrify -resize 2048 *.jpg

resize to certain filesize

will take 4 to 8 times longer

convert INPUT -define jpeg:extent=2MB OUTPUT

Convert to thumbs

mogrify -resize x400 *.jpg   # all jpg's in folder are resized to height 400px (overwriting originals)

Convert 16 bit grayscale png to 16 bits raw

stream -map r -storage-type short earth-elevation.png earth-elevation.raw


convert input.png output.gray

Convert 16 bit grayscale png to 2 separate 8 bits png's

there must be a better way...

convert input16bits.png 16.gray
convert -size 4096x2048 -endian MSB 16bits.gray -depth 8 8bits-hi.png
convert -size 4096x2048 -endian LSB 16bits.gray -depth 8 8bits-lo.png

contrast-stretch / normalize

convert earth-elevation.png -depth 16 -normalize earth.png

convert pdf to png high quality

convert           \
   -verbose       \
   -density 150   \
   -trim          \
    test.pdf      \
   -quality 100   \
   -flatten       \
   -sharpen 0x1.0 \

convert from 16bit to red+green channel

(somehow this doesn't work for me anymore)

convert Mars_8k_16bit.tif -depth 24 mars24.rgb
convert -size 8192x4096 -depth 8 rgb:mars24.rgb mars_redgreen.png

convert DDS to PNG

convert Mars-normalmap_8k.png

1 resize (sample) very large image file

convert -debug cache -limit area 1GB  /Users/rick/Downloads/Mars_MGS_MOLA_DEM_mosaic_global_463m.tif -sample 4096x2048 test.tiff

2 create redgreen gradient palette 64k wide

convert -size 10x65535  -rotate -90  gradient:red-green  redgreen.png
# black-yellow
convert -size 1x65535 -rotate -90   gradient:black-yellow blackyellow.png

3 lookup colors in palette (not sure yet if it solves my problem)

convert -interpolate bilinear /Users/rick/Downloads/mars-8k-16bpp-bump.tiff redgreen.png -clut -depth 8 out.png


convert -size 1x65535 -rotate -90   gradient:black-yellow blackyellow.png
convert -interpolate bilinear Mars_8k_Disp_v001.tif blackyellow.png -clut -depth 8 out.png

Convert multiple jpg's into bmp's

for i in *.jpg; do sips -s format bmp $i --out ../clouds-201509-bmp/$i.bmp;done

Resize batch

first height, then width!

  for i in *.jpg; do sips -z 1024 2048 $i --out ../clouds-201509-2k/$i;done

create gradient

convert -size 100x300 gradient:#000-#f00 gradient:#f00-#ff0 gradient:#ff0-#fff gradient:#fff-#0ff gradient:#0ff-#00f gradient:#00f-#000 -append lut.png