Image Manipulation Toolbox

Version 1.56 (17.7 MB) by DGM
MATLAB Image Manipulation Toolbox
7K Downloads
Updated 4 Jul 2024
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, R2015b, and R2019b. Some effort has been made to make sure most tools work regardless of MATLAB version.
Only a few files require Image Processing Toolbox, though having IPT is often beneficial. See DEPENDENCIES.txt for notes on replacements for certain IPT functionality.
Let me know if you find bugs.
Highlights:
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.
GRAPHICAL INTERFACES
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
FILE HANDLING
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
imreadort --read JPG files with correct EXIF orientation
mimread --import an arbitrary selection of image files into a cell array
wpread --read WEBP images
wpwrite --write WEBP images
CONVERSION
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
UTILITIES
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()
cshist --color image histogram tool for multiple colorspaces
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
hex2uint --convert prefixed hexadecimal tuples to numeric
im2ct --create a color table from the dominant colors of an image
imcast --convenient typecasting & scaling for images
imclamp --clamp values to within a specified range
imclassrange --get nominal black/white range for a class name
imerror --calculate RMS and mean-square error
imhistFB --grayscale/indexed image histogram tool with more features than IPT imhist()
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
intervalct --generate a minimal-length discrete interval colortable
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
matchframes --make two images have the same number of frames
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
squaresize --aid for resizing a vector into a roughly-square matrix
strismember --see if a string is a member of a set of strings
uint2hexr --convert numeric tuples to prefixed hexadecimal
FIELD GENERATION
brline --draw a non-antialiased line or polylines
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
MASK GENERATION
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
DITHERS
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
COLOR ADJUSTMENT
adapthisteqFB --perform CLAHE contrast enhancement
autowb --simple automatic white balance for photos
colorbalance --replicates the GIMP Color Balance tool
gcolorize --replicates the GIMP Colorize tool
ghlstool --replicates the GIMP Hue-Saturation tool
histeqFB --perform histogram equalization
histeqtool --apply histeq()/adapthisteq() to color images in different ways
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
IMAGE MANIPULATION
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
amedfilt --adaptive median noise removal filter
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
crop2box --crop a mask to its bounding box
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
fmedfilt --fixed-window median noise removal filter
gray2rgb --expand an I/IA image to RGB/RGBA
gray2pcolor --convert a grayscale image to a pseudocolored RGB image
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
imcropzoom --interactively use IPT imcrop() with less hassle
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
pickblob --return a mask describing the blobs selected by one or more points
ptile --tile a small image to fill a specified geometry
pseudoblurmap --multipass variable-kernel blur approximation
puttext --insert colored or padded text in an image
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
uniquant --convert an array to an index map by uniform quantization
unsharp --sharpen an image using unsharp masking
zblend --use a mask to blend between images in a 4-D array
NOVELTIES
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
gbcam --emulate the appearance of a photo taken with a GameBoy camera
genknit --generate images of interlocking (knit) curves
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 (2024). Image Manipulation Toolbox (https://github.com/291ce4321ac/MIMT/releases/tag/v1.56), 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

MIMT/FEX_dependencies

MIMT/FEX_dependencies/Inpaint_nans

MIMT/FEX_dependencies/Inpaint_nans/doc

MIMT/FEX_dependencies/Inpaint_nans/test

MIMT/FEX_dependencies/STFT toolbox

MIMT/FEX_dependencies/addaxis

MIMT/FEX_dependencies/generalized_dt

MIMT/FEX_dependencies/gp_toolbox_excerpt

MIMT/FEX_dependencies/ifversion_fex

MIMT/MIMT_private

MIMT/cs_conversion_tools

MIMT/demo scripts

MIMT/imblend_core

Version Published Release Notes
1.56

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.56

1.55

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.55

1.54.0.0

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.54

1.53.1.0

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.53.1

1.53.0.0

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.53

1.52.0.0

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.52

1.51.1.0

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.51.1

1.51.0.0

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.51

1.50.0.0

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.50

1.49

See release notes for this release on GitHub: https://github.com/291ce4321ac/MIMT/releases/tag/v1.49

1.48.1

some bugfixes

1.48

some bugfixes
minor improvements
major rewrite of imrescale/imtweak
ADDED: ctshift, rbdetile, ptile + pattern library, impatmap, impatsort, patbinchart, framecount

1.47

various bugfixes
complete rewrite of replacepixels()

ADDED
uwredcomp, gray2rgb, joinalpha, alphasafe, ctpath

1.46

added linear RGB blending to lingrad/radgrad
added full I/IA/RGB/RGBA support to gcolorize
other minor bits

1.45

some minor improvements

ADDED
imbcg
colorbalance
gcolorize
mixchannels
ghlstool
gmrgb2cmyk
gmcmyk2rgb
tonergb
tonecmyk
tonepreset
unsharp
bwfilmemu
FXF_collection demo script with examples replicating GIMP plugins and GMIC tools using MIMT

1.44

various improvements, bugfixes

ADDED
ctflop
imclamp
solarize
imcurves
splitalpha

1.43

major rewrite of csview removes colorspace() dependency and GUIDE usage
several new tools
a handful of bug fixes
See CHANGELOG.txt

1.42

several bugfixes
several improvements
tidied up code formatting
new fonts for textim()
added: randisum jellyroll imrectify circmean ccmap makect agm ghm splitchans gettfm imgeofilt

1.41

some bugfixes
lots of improvements (see CHANGELOG.txt)
added some files

1.40

see CHANGELOG.txt

1.39

IMPROVED: several files
ADDED: hitmiss morphnhood bwlabelFB despeckle bwdistFB imhistFB histeqFB imhistmatchFB adapthisteqFB

this removes IPT dependency from all but a couple files; see DEPENDENCIES.txt

1.38

Added replacements for imresize, imrotate, imfilter, padarray, imcrop, and the basic morphological tools, removing the majority of the remaining dependence on IPT.

also fixed several stupid bugs and improved a few things

1.37

textim: added more fonts
added: textblock, cp437, drysize
improved: imblend, imstacker
added lost_bomb_recovery tool for use with imblend

1.36.2

added textim
added imblend modes 'suau dodge' and 'suau burn'

1.36.1.1

updated description with new docs url

1.36.1

imblend: sped up a couple modes with fast cases, minor synopsis edits
imcompose: consistency fix for some of the new mode changes

1.36

assorted bugfixes
minor docs improvement
significant imblend reorganization for correctness and consistency
added imsize, dotmask

1.35

lots of bug fixes
starting to fix compatibility issues with newer versions
various improvements
ADDED
mlmask
imcontmip
imcontfdx
fdblend
imones
imzeros

1.34.1.0

minor update to imblend to add parameterization to the new modes

1.34.0.0

FIXED: several documentation and demo bugs caused by syntax changes in some tools
class support mode in mono()

IMPROVED: rewrote randlines, perlin
added modes to imblend

ADDED: simnorm()

1.33.0.1

synopsis edit, as usual

1.33.0

Fixed: 7 tools
Improved: 29 tools
Added: color2alpha, colorpicker, continuize, edgemap, fkgen, imdetile, imtile, imstats, isimageclass, isopaque, issolidcolor, lcmap, maketileable, matchchannels, pseudoblurmap, imrescale

1.32.1

missed a couple files

1.32

three new modes added to imblend; other imblend improvements

1.31.0.1

minor FEX description edit

1.31

IMPROVED: imblend, imcompose, mergedown, gif tools, addborder, mono, lch & husl tools, thresholdinpaint, cropborder
ADDED: chancount, icparams, imrectrotate, imannrotate, extractbg, imrecolor, colorquant, imlnclite
various bugfixes

1.30.1

forgot to include the update to imcompose

1.30

update to imblend():
added 'softlighteb2', a parametric, symmetric, continuous softlight method

1.29.1

synopsis edit in a file

1.29

minor updates to addborder, imblend
typo fixes in imfold, imcartpol

1.28

FIXED: stretchlimFB, imcompare, imblend, text2spectrogram, im2spectrogram
IMPROVED: imblend, imcompose, imshow2, ismono
ADDED: memsize

1.27.0.0

speed improvements to imblend
imcartpol now supports capture of randomized transformations for re-use

1.26.1.0

attempt to fix description formatting
attempt to fix formatting again
try again
fixed a bug in imshow2 and gifwrite for logical images

1.26.0.0

displace: added interpolation, cleaned a few things up
imshow2: added 4D support and a stack browsing gui mode
ADDED: imcartpol, mimread, imstacker

1.25.0.0

FIXED: meanlines, addborder, zfdither
IMPROVED: shuffle, glasstiles, imcompose, randlines, mergedown, immodify
ADDED: randrange, noisedither, imfold, erraccumulate

1.24.1.0

bugfix in imtweak for 4-D inputs and HSY mode

1.24.0.0

updated gif tools

1.23.0.0

BUGFIXES: permutechannels, imcompose, imblend, imlnc, orddither, hsy2rgb
IMPROVED: permutechannels, eoline, imcompose, imblend, immodify, imlnc, gif & gradient tools
ADDED: arborddither, linedither, lcdemu, bicoloradapt, xwline, zblend, imdrag

1.22.0.0

bugfix in replacepixels
imcompare:
added NaN & OoG view modes and counts
uses linked axes instead of concatenation for 2-up view

1.21.0.0

updates and bugfixes in image conversion tools
geometry and view control updates to GUI tools (now uses akZoom)
introduction of IMMASK
csview fixed to work in subplots

1.20.0.0

removed more dependencies:
csview, vectorscan, thresholdinpaint, picdynamics

see DEPENDENCIES.txt for list of IPT and FEX dependencies

1.19.0.0

removed IPT dependency from MOST tools (see text file)
REPLACEPIXELS replaces BLENDMASK
IMLNC replaces IMADJUST3
lots of cleanup, extra class support, etc
updated description

1.18.0.0

added IPT dependency note
no room left in description
bugfix in imcompose and imgenerate
expanded functionality of imadjust3 and immodify
added more class support to imtweak, imadjust3, others

1.17.0.0

added Zhou-Fang and ordered dither tools for use with IMBLEND, etc
major updates to imblend and imcompose
minor update to jpegger, imgenerate, immodify

1.16.1.0

minor imblend update

1.16.0.0

minor imblend update

1.15.0.0

added GUI tools (imcompose, imcompare, immodify, imgenerate, cpicktool)
updated imblend, imadjust3, meanlines

1.14.0.0

updates to imblend, replacepixels, tonemap, and LCH conversion LUT's
smaller package size

1.13.0.0

removed colorspace dependency from core tools (imblend, imtweak)
expanded and improved imblend and tonemap

1.12.0.0

updated blend tools

1.11.0.0

updated imblend() with compositing options

1.10.0.0

updated 'imblend' with new modes
added contour plot reference for imblend modes

1.9.0.0

batchloader() now supports images with alpha
imblend() now supports alpha compositing
maxchroma() and RGB-LCH tools now support SRLAB2

1.8.0.0

updated docs links
code cleanup in sRGB-LCH functions for accuracy & extensibility
added d50 adaptation mode to LCH conversions out of sheer boredom
corrected CSVIEW() plot orientation in CIEXYZ mode

1.7.1.0

bugfix in maxchroma()
fixes convergence problem in 'labcalc' mode for some images
also did some minor speed optimization

1.7.0.0

fixed edge convergence inaccuracy in MAXCHROMA() for LAB in direct calculation mode
see manual page or blog for details

1.6.0.0

bugfix in csview
added alpha adjustment to csview gui tool
moved boundary chroma calculations from LCH and HuSL tools to a standalone function
added tentative direct calculation method for LAB, updated LABLUT.mat with more accurate calculations

1.5.0.0

removed obsolete dependency check from imtweak
added YPP mode to imtweak for sake of completeness with regard to YPP/HSY, LCH/HuSL symmetry
updated speed benchmarks

1.4.0.0

modified LCH conversion tools to provide optional data truncation methods
changed IMTWEAK and IMBLEND to use bounded LCH methods
cleaned up IMBLEND color modes
added native modes to HuSL and HSY conversion tools

1.3.1.0

bugfix in imtweak HSL transfer mode

1.3.0.0

added HSYp & HSL support to IMBLEND() and cleaned up some dependency checks

1.2.0.0

added HSYp option to HSY conversion methods
added HSYp support to IMTWEAK()

1.1.0.0

added HuSLp support to RGB-HuSL converters
added HuSLp and LCHab/uv support to IMTWEAK()

1.0.0.0

modified description

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.