Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

WolframConsulting.com

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
ColorDistance
  • See Also
    • ColorsNear
    • LABColor
    • RGBColor
    • LUVColor
    • XYZColor
    • CMYKColor
    • Hue
    • ImageDistance
    • DominantColors
    • MinColorDistance
    • EuclideanDistance
    • Nearest
    • CentralFeature
  • Related Guides
    • Colors
    • Distance and Similarity Measures
    • Color Processing
    • See Also
      • ColorsNear
      • LABColor
      • RGBColor
      • LUVColor
      • XYZColor
      • CMYKColor
      • Hue
      • ImageDistance
      • DominantColors
      • MinColorDistance
      • EuclideanDistance
      • Nearest
      • CentralFeature
    • Related Guides
      • Colors
      • Distance and Similarity Measures
      • Color Processing

ColorDistance[c1,c2]

gives the approximate perceptual distance between color directives c1 and c2.

ColorDistance[list,c]

gives color distances between elements of list and c.

ColorDistance[list1,list2]

gives color distances between corresponding elements of list1 and list2.

ColorDistance[image,c]

gives an image whose pixel values are color distance between pixels in image and the color c.

ColorDistance[image1,image2]

yields an image giving the pixelwise color distance between image1 and image2.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Options  
DistanceFunction  
Applications  
Properties & Relations  
Neat Examples  
See Also
Related Guides
Related Links
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • ColorsNear
    • LABColor
    • RGBColor
    • LUVColor
    • XYZColor
    • CMYKColor
    • Hue
    • ImageDistance
    • DominantColors
    • MinColorDistance
    • EuclideanDistance
    • Nearest
    • CentralFeature
  • Related Guides
    • Colors
    • Distance and Similarity Measures
    • Color Processing
    • See Also
      • ColorsNear
      • LABColor
      • RGBColor
      • LUVColor
      • XYZColor
      • CMYKColor
      • Hue
      • ImageDistance
      • DominantColors
      • MinColorDistance
      • EuclideanDistance
      • Nearest
      • CentralFeature
    • Related Guides
      • Colors
      • Distance and Similarity Measures
      • Color Processing

ColorDistance

ColorDistance[c1,c2]

gives the approximate perceptual distance between color directives c1 and c2.

ColorDistance[list,c]

gives color distances between elements of list and c.

ColorDistance[list1,list2]

gives color distances between corresponding elements of list1 and list2.

ColorDistance[image,c]

gives an image whose pixel values are color distance between pixels in image and the color c.

ColorDistance[image1,image2]

yields an image giving the pixelwise color distance between image1 and image2.

Details and Options

  • Color distance, also known as color difference, gives a measure of visual, perceptual color differences. Perceptually similar colors have smaller distance.
  • ColorDistance computes the distance between two colors as the Euclidean distance between the two color vectors in the LABColor space.
  • In the computation of the color distance, the alpha channel is ignored.
  • ColorDistance works with arbitrary 2D and 3D images.
  • With ColorDistance[image,…], color distances are returned as an image of a real type with the same dimensions as image.
  • With ColorDistance[image1,image2], image1 and image2 are center aligned, and an image of color distances for the overlapping pixels is returned.
  • ColorDistance supports a DistanceFunction option. The following settings are available:
  • "CIE76"Euclidean distance in LABColor (default)
    "CIE94"color difference defined in LCHColor
    "CIE2000"CIE94 with some corrections
    {"CMC",{l,c}}Color Measurement Committee metric with lightness l and chroma c
    "DeltaL"luminance difference in LCHColor
    "DeltaC"chroma difference in LCHColor
    "DeltaH"hue-based difference in LCHColor
    ffunction f that is given two lists of Lab values
  • With the "CMC" metric, commonly used parameters are for perceptibility and for acceptability. If not specified, is used.

Examples

open all close all

Basic Examples  (2)

Distance between two colors:

Distance between a color and each pixel of an image:

Scope  (5)

Distance between colors defined in different color spaces:

Distance between each element of a color array and a color:

Distance between color arrays:

Color distance between two images:

Color distance between the central regions of images with different dimensions:

Options  (8)

DistanceFunction  (8)

By default, "CIE76" (also spelled ΔEa*b*) is used:

This corresponds to EuclideanDistance for LABColor components:

Visualize the "CIE76" color distance in the "LAB" space:

Use "CIE94" measure for computing the color distance (also spelled ΔE94):

Note that this measure is not symmetric:

Use "CIE2000" measure for computing the color distance (also spelled "CIEDE2000" or ΔE00):

Note that this measure is symmetric:

Use "CMC" color distance:

Use "DeltaL" color distance:

Distance between L* channels visualized in the "LAB" space:

Use "DeltaC" color distance:

Distance between two color chromas, each being computed as Norm[{a^*,b^*}]:

Use "DeltaH" color distance:

Use a custom distance function that is only based on the luminance:

Applications  (6)

Highlight details in an image using a selective desaturation:

Segment components of specific colors in an image:

Detect motion by comparing two images:

This image has a strong red color cast:

The default distance considers differences in hue, luminance, and chroma:

Use DistanceFunction"DeltaH" to measure only the differences in hue:

Cluster a list of colors based on their distance:

Sort a list of colors using their perceptual distance from a reference color:

Compare to sorting based on RGB values:

Properties & Relations  (8)

ColorDistance is equivalent to EuclideanDistance of the color in the LABColor space:

The distance between a color and itself is always zero:

The distance between a color represented in two color spaces is zero:

Notice that this distance may be nonzero if the color is not available in the new color space:

The alpha channel is not used when computing the distance:

For RGB colors, the typical range of distances for each method is as follows:

Define a sample set using the boundary of the RGB cube:

Compute all pairwise distances between the sample colors:

Compute the range:

Not all the color distances are metrics in a mathematical sense:

"CIE76"
"CIE94"
"CIE2000"
"CMC"
"DeltaL"
"DeltaC"
"DeltaH"
"non-negativity"
✓✓✓✓✓✓✓
"coincidence axiom"
✓✓✓✓
"-"
"-"
"-"
"symmetry"
✓
"-"
✓
"-"
✓✓✓
"triangle inequality"
✓
"-"
"-"
"-"
✓✓
"-"

"CIE94" and "CMC" are not symmetric:

"CIE94", "CIE2000", "CMC", and "DeltaH" do not always satisfy the triangle inequality:

Simulated frequencies of satisfying the triangular inequality depend on the specified distance:

"CIE2000" is one of the latest standards, introducing many improvements over the simple Lab distance. It is perceptually more accurate compared to "CIE76" and "CIE94":

Show constant-distance curves on the plane for a fixed lightness, :

However, "CIE2000" is computationally more expensive compared to the older metrics:

ImageDistance by default computes the Euclidean distance between two images in the RGB space:

ColorDistance by default computes the Euclidean distance between two pixels in the LAB space:

ColorDistance returns the distance between the central regions of images with different dimensions:

The distance between two images may be identically zero if their overlapping regions coincide:

Neat Examples  (1)

Colorize an image using distance maps from three primary colors:

See Also

ColorsNear  LABColor  RGBColor  LUVColor  XYZColor  CMYKColor  Hue  ImageDistance  DominantColors  MinColorDistance  EuclideanDistance  Nearest  CentralFeature

Function Repository: NearestColorName

Related Guides

    ▪
  • Colors
  • ▪
  • Distance and Similarity Measures
  • ▪
  • Color Processing

Related Links

  • An Elementary Introduction to the Wolfram Language : Machine Learning

History

Introduced in 2014 (10.0) | Updated in 2015 (10.2)

Wolfram Research (2014), ColorDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorDistance.html (updated 2015).

Text

Wolfram Research (2014), ColorDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorDistance.html (updated 2015).

CMS

Wolfram Language. 2014. "ColorDistance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/ColorDistance.html.

APA

Wolfram Language. (2014). ColorDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorDistance.html

BibTeX

@misc{reference.wolfram_2025_colordistance, author="Wolfram Research", title="{ColorDistance}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/ColorDistance.html}", note=[Accessed: 01-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_colordistance, organization={Wolfram Research}, title={ColorDistance}, year={2015}, url={https://reference.wolfram.com/language/ref/ColorDistance.html}, note=[Accessed: 01-December-2025]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Player
  • Wolfram Engine

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2025 Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English