Image Manipulation Toolbox

version 1.49 (17.2 MB) by DGM
A large collection of image manipulation tools of varying utility


Updated 30 Sep 2022

From GitHub

View License on GitHub

This library is a loose collection of image manipulation and degradation functions I originally developed as part of a meandering set of 'artistic' hobbies. While I have tried to extend several of the functions toward a more general utility in image editing or analysis, understand that not all of these functions began life with that intention. I post these tools only on the basic assumption that if they have been useful to me, then surely they'll be useful in part to someone else.
This was written and tested in R2009b and R2015b, with cursory testing in R2012a and R2019b.
Only a few files use IP Toolbox (see DEPENDENCIES.txt)
Let me know if you find bugs.
GUI extensions of several core functions
Passthrough/fallback replacements for several IPT tools
Multi-model color picker GUI
GUI for parametric color-based mask generation
Image viewer with support for alpha and 4D image browsing
Image blending, compositing and masking tools
Color adjustment in various color models
Contrast or chroma enhancement via levels/curves tool (RGB or LAB)
Bidirectional colorspace conversion tools (HSL, HSI, HSY, HSYp, HuSL, HuSLp, LCHab, LCHuv, SRLAB2, OKLAB, YCH, HWB)
Animated GIF import/export tools
4D image array support on many functions
GIMP compatibility in several tools
Documentation with commentary and examples is available at the link above.
cpicktool --interactive color picker GUI
colorpicker --interactively select colors from an image
csview --visualize the projection of RGB in other spaces
imcompare --interactively compare two images (GUI)
imcompose --interactively compose image from layers (GUI)
imgenerate --interactively generate simple images (GUI)
immask --interactively create selections
immodify --interactively modify an image (GUI)
imshow2 --image viewer with transparency & 4D support
batchloader --load arbitrary subsets from a prefixed set of image files
gifread --read animated gif files to 4-D array
gifwrite --write animated gif file from 4-D array
mimread --import an arbitrary selection of image files into a cell array
gettfm --get transformation matrix for luma-chroma models
gmcmyk2rgb --naive conversion between CMYK and RGB
gmrgb2cmyk --naive conversion between RGB and CMYK
hsi2rgb --convert HSI image to sRGB
hsl2rgb --convert HSL image to sRGB
hsy2rgb --convert HSY image to sRGB
husl2rgb --convert HuSL image to sRGB
hwb2rgb --convert HWB image to sRGB
imappmat --apply color transformation matrix
lab2lch --convert rectangular models to polar
lch2lab --convert polar models to rectangular
lch2rgb --convert LCH image to sRGB
linear2rgb --convert linear RGB to sRGB
maxchroma --calculate extent of sRGB in other spaces
rgb2hsi --convert sRGB image to HSI
rgb2hsl --convert sRGB image to HSL
rgb2hsy --convert sRGB image to HSY
rgb2husl --convert sRGB image to HuSL
rgb2hwb --convert sRGB image to HWB
rgb2lch --convert sRGB image to LCH
rgb2linear --convert sRGB to linear RGB
agm --arithmetic-geometric mean
ccmap --return colormaps used by MIMT documentation
circmean --circular mean of angles
chancount --fetch info about image color and alpha channels
colordiff --calculate Delta-E color differences
cp437 --simulate the use of IBM cp437 as utilized by textim()
ctflop --permute a color table to process as an image
ctpath --visualize the trajectory of a colormap in 3D
ctshift --nonlinearly shift the contents of a colormap while preserving the ends
drysize --precalculate output dimensions from imresize()
factor2 --find the factor pairs of an integer
factor3 --find the factor triples of an integer
flipd --version-agnostic wrapper for flip() and flipdim()
fourdee --make non-4D functions work on 4D images
ghm --geometric-harmonic mean
imcast --convenient typecasting & scaling for images
imclamp --clamp values to within a specified range
imerror --calculate RMS and mean-square error
imhistFB --calculate the image histogram
imrange --return global min and max values from any size array
imrescale --rescale data based on explicit class assertion
imsize --fetch array size independent of dimensionality
imstats --calculate various metrics regarding image colors
isimageclass --test if image is of an appropriate class
isopaque --test if an image is opaque
issolidcolor --test if an image consists of a single color
ismono --determine if image is monochrome
maketileable --make image size integer-divisible
makect --make a simple 2-point linear color table
matchchannels --make an image and color tuple correspond
memsize --show the memory footprint of any variable
randisum --random integers with a specified sum
randrange --conveniently generate random numbers in a specified range
roundeven --round/ceil/floor to even integers
roundodd --round/ceil/floor to odd integers
simnorm --simple data normalization
strismember --see if a string is a member of a set of strings
colorpict --easily produce solid color filled image
fkgen --generate atypical filter kernels
freecb --generate a checkerboard of any size or alignment
imcheckerboard --generate a symmetric checkerboard image
imgenerate --interactively generate simple images (GUI)
imones --generalized version of ones() for all image classes
imzeros --generalized version of zeros() for all image classes
lingrad --two-point or multipoint linear gradient
perlin --create pseudo-perlin noise clouds
perlin3 --create 3-D perlin noise fields
radgrad --two-point or multipoint radial gradient
randlines --create various fields of random lines and walks
randspots --create fields of randomly located shapes
textblock --generate an image of multiline text
textim --generate an image of a single line of text
xwline --create anti-aliased lines or polylines
findpixels --create a mask of pixels relative to a color
immask --interactively create selections (GUI)
mlmask --simple multilevel mask generation
multimask --make mask from a combination of color matches
rangemask --make mask from a combination of color matches
arborddither --multilevel ordered dither with support for arbitrary index arrays
linedither --multilevel dither consisting of variable density line segments
noisedither --binarize image using white or blue noise thresholding
orddither --reduce image using ordered dither
zfdither --reduce image using Zhou-Fang dither
adapthisteqFB --perform CLAHE contrast enhancement
colorbalance --replicates the GIMP Color Balance tool
gcolorize --replicates the GIMP Colorize tool
ghlstool --replicates the GIMP Hue-Saturation tool
histeqFB --perform histogram equalization
imadjustFB --passthrough for imadjust with fallback for non-IPT installs
imbcg --basic brightness-contrast-gamma tool with optional GIMP compatibility
imcurves --apply an arbitrary curve to the intensity values
iminv --invert (complement) an image
imlnc --flexible contrast adjustment on I/RGB images
imlnclite --lightweight version of imlnc for use on large images
immodify --interactively modify an image (GUI)
imtweak --adjust channels of an image or color
mixchannels --replicates the GIMP Channel Mixer tool
stretchlimFB --passthrough for stretchlim with fallback for non-IPT installs
tonecmyk --replicates the GMIC CMYK Tone tool
tonergb --replicates the GMIC RGB Tone tool
uwredcomp --adjust underwater photographs for contrast and color compensation
addborder --add a colored border to an image
alphasafe --compose image with checkerboard matting to visualize transparency
alternate --build an image by alternating samples from two or more images
blockify --flexible spatial downsampling of images
bwareafiltFB --select pixel groups based on size
bwdistFB --distance transform for binary images
bwlabelFB --labeling of connected groups
color2alpha --generate alpha from a selected color
colorquant --color quantization using octree decomposition
cropborder --easily crop a border from an image
dealternate --undo an alternate() operation
deinterleave --undo an interleave() operation
despeckle --remove small pixel groups
displace --apply a displacement map to an image
dotmask --compare two images using an adjustable mask
edgemap --normalized Scharr filter effect
eoframe --extract every Nth frame from an image set
eoline --erase every n/N lines from an image
extractbg --calculate bg estimate from multiframe image or video
flattenbg --reduce low-frequency image variation
gray2rgb --expand an I/IA image to RGB/RGBA
hitmiss --hit-miss filter for binary images
icparams --class for image composition parameter objects
imblend --blend two images
imcompose --interactively compose image from layers (GUI)
imcropFB --extract a rectangular ROI from an image
imdetile --rearrange a flat image into a 4D image stack
imfilterFB --filter/blur an image by convolution/correlation
imgeofilt --geometric mean filter
imhistmatchFB --make an image inherit the intensity distribution of another
immodify --interactively modify an image (GUI)
imnoiseFB --add selected noise type to an image
imrectify --interactively devectorize an image of unknown geometry
imresizeFB --resize an image
imrotateFB --rotate an image
imsharpenFB --perform an unsharp masking operation
imstacker --concatenate dissimilar images on dim 1, 2, or 4
imtile --rearrange a 4D image stack into a flat image
interleave --interleave two or more images along an axis
joinalpha --append an alpha channel to an image or merge with existing alpha
meanlines --create a new image from vector means or extrema
mergedown --merge all frames of a 4-D image
mono --extract a single channel (RGBHSVY)
morphnhood --neighborhood-based morphological operations
morphops --perform morphological operations
nhfilter --nonlinear sliding-window filter operations
padarrayFB --pad the edges of an image
ptile --tile a small image to fill a specified geometry
pseudoblurmap --multipass variable-kernel blur approximation
replacepixels --replace masked pixels with new color or second image
roifilter --restrict the application of a filter by using a mask
splitchans --split a color image into its components
splitalpha --split a color image into its color and alpha components
tonemap --apply tone map to an image
unsharp --sharpen an image using unsharp masking
zblend --use a mask to blend between images in a 4-D array
bicoloradapt --emulate visual adaptation to a damaged CRT display
bwfilmemu --roughly emulate the appearance of various BW film types
continuize --add smoothing to discontinuous image transformations
dilatemargins --selective dilation & erosion on image extrema
driftds --changing superpixel boundaries create the illusion of motion
erraccumulate --generate rounding error maps inefficiently
fdblend --cyclic 4D permutation/blending for imcontfdx
glasstiles --create a simple effect like privacy glass
im2ods --encode an image in spreadsheet cells
im2spectrogram --encode an image in audio spectra
imannrotate --rotate an image using simple annular shifting
imcartpol --fun with coordinate mapping
imcontfdx --continuized masked subvector transformation
imcontmip --continuized masked image index permutation
imdestroyer --randomly selected and parameterized image manipulation
imdrag --create subvector smearing effect
imecho --perform frame blending on a 4-D image
imfold --generate an image stack as if repeatedly fan-folding an image
impatmap --convert an image to a grayscale collage of tileable patterns
impatsort --sort and group pattern images by their mean gray level
imrecolor --recolor an image based on the colors of another
imrectrotate --rotate an image using pixel displacement
jellyroll --vectorize an image and then devectorize it in a spiral
jpegger --degrade image with jpeg compression
jpegslur --translate compression error into line displacement
lcdemu --emulate angle-dependence of a bad LCD display
lineshifter --shift lines by vector means of a specified mask
paritysweep --explore parity distribution in a compressed image
patbinchart --visualize the binning performed by impatsort()
permutechannels --permute rgb or hsv channels
picdynamics --LTI system response simulation on image rows
rbdetile --random blockwise detiler
rectds --randomly located rectangles of mean image color
roiflip --flip lines in an area specified by a mask
roishift --shift lines in an area specified by a mask
rotateds --cyclic shifting and downsampling of an image
shuffle --divide image into tiles and permute them
siftpixels --migrate non-nan pixels in a given direction
solarize --apply a solarization effect to an image
straightshifter --shift image channels
text2spectrogram --encode a text marquee in audio spectra
thresholdinpaint --erase and then attempt to fill masked pixels
tonepreset --apply one of several presets for color images
vectorscan --emulate the appearance of a scan processor output
This archive includes all image conversion/blending tools I've submitted to date

Cite As

DGM (2022). Image Manipulation Toolbox (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!






MIMT/FEX_dependencies/STFT toolbox





MIMT/demo scripts


To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.