File Exchange

image thumbnail

Image Manipulation Toolbox

version 1.32.1 (10.2 MB) by DGM
A large collection of image manipulation tools of varying utility


Updated 12 Apr 2020

View License

This library is a loose collection of image manipulation and degradation functions I 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 none 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.

Requires IP Toolbox for some things (see DEPENDENCIES.txt)
Let me know if there are bugs.

GUI extensions of several core functions
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, YCH)
Animated GIF import/export tools
4D image array support on many functions
GIMP compatibility in several tool modes

Documentation with commentary, example code, and input/output images is available here:

cpicktool  --interactive color picker GUI
csview  --visualize the projection of sRGB in other spaces
imcompare  --interactively compare two images
imcompose  --compose image from layers as in GIMP or Photoshop
imgenerate  --interactively generate simple images
immask  --interactively generate selections (parametric magic wand, etc)
immodify  --interactively modify an image
imshow2  --image viewer with alpha & 4D support and better view controls

fourdee  --make non-4D functions work on 4D images
imrange  --return global min and max values from any size array
ismono  --determine if image is monochrome
mimread  --import arbitrary selection of files
imstacker  --arrange mismatched images into a 4D array

colorpict  --easily produce solid color filled image
extractbg  --background estimation for 4D image or video
findpixels  --create a mask of pixels relative to a color
lingrad  --two-point or multipoint linear gradient
meanlines  --create a new image from vector means or extrema
mono  --extract a single channel (R,G,B,H,S,V,Y,etc)
multimask  --make mask from a combination of color matches
perlin  --create cloudlike noise images
perlin3  --create perlin noise volumes
radgrad  --two-point or multipoint radial gradient
randlines  --create various fields of random lines and walks
randspots  --create fields of randomly located shapes
rangemask  --make mask from a combination of color matches
xwline  --Xiaolin-Wu antialiased polyline tool

addborder  --add a colored border to an image
colorquant  --color quantization tool
cropborder  --easily crop a border from an image
eoframe  --extract every Nth frame from an image set
eoline  --erase every n/N lines from an image
imlnc  --contrast enhancement tool (levels, curves, histeq, chroma)
imblend  --blend or composite images (with comprehensive options)
imcast  --flexible typecasting & scaling (without IPT)
imfold  --repeatedly fan-fold an image into a 4D stack
imrecolor  --histogram-based color matching between images
imtweak  --adjust channels of an image or color
maxchroma  --calculate sRGB gamut extent in other spaces
mergedown  --merge frames of a 4-D image
permutechannels  --permute rgb or hsv channels
replacepixels  --replace pixels with new color or second image
roiflip  --flip lines in an area specified by a mask
roishift  --shift lines in an area specified by a mask
straightshifter  --shift image channels
tonemap  --apply a tone map to an image
zblend  --use a mask to create a section of a 4D image

blockify  --flexible spatial downsampling
dilatemargins  --selective dilation & erosion on extrema
displace  --apply a displacement map
driftds  --changing superpixel boundaries create illusion of motion
glasstiles  --create a simple effect like glass tiles
imcartpol  --cart2pol/pol2cart/radial inversion w/lots of features
imecho  --perform frame blending on a 4-D image
imrectrotate  --normalized & constrained rotation by pixel displacement
jpegslur  --translate compression error into line displacement
lineshifter  --shift lines by vector means of a specified mask
paritysweep  --explore parity distribution in a compressed image
picdynamics  --LTI system response simulation on image rows
rectds  --randomly located rectangles of mean image color
shuffle  --divide image into tiles and permute them
vectorscan  --emulate the appearance of a scan processor output

multiframe GIF read/write tools
colorspace conversions
dithers (Zhou-Fang, Bayer, & 3 others)
spectrogram & spreadsheet novelties
and others

This archive includes all image conversion/blending tools I've submitted to date

Cite As

DGM (2020). Image Manipulation Toolbox (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Coco Newton

Thx for uploading toolbox. Good for you!



missed a couple files


three new modes added to imblend; other imblend improvements

minor FEX description edit


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


forgot to include the update to imcompose


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


synopsis edit in a file


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


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

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

try again

attempt to fix formatting again

attempt to fix description formatting

fixed a bug in imshow2 and gifwrite for logical images

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

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

bugfix in imtweak for 4-D inputs and HSY mode

updated gif tools

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

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

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

removed more dependencies:
csview, vectorscan, thresholdinpaint, picdynamics

see DEPENDENCIES.txt for list of IPT and FEX dependencies

updated description

removed IPT dependency from MOST tools (see text file)
lots of cleanup, extra class support, etc

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

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

minor imblend update

minor imblend update

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

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

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

updated blend tools

updated imblend() with compositing options

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

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

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

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

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

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

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

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

bugfix in imtweak HSL transfer mode

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

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

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

modified description

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