Function Repository Resource:

ImagePalettePlumes

Source Notebook

Visualize an image's palette as a series of feathers

Contributed by: Mark Greenberg

ResourceFunction["ImagePalettePlumes"][img]

spreads out the colors used by img in the form of feathers.

Details and Options

The pixels of img are sorted by hue, divided into equal portions (the feathers), and divided again into 100 equal portions for each feather (the rami) which are then sorted by brightness. These sorted groups of pixels become the color functions for the curves of each ramus.
The bins in ResourceFunction["ImagePalettePlumes"] are determined by actual colors used, in contrast to a histogram's bins which are equal parts of the hue spectrum. For example, if there is no red in img, then the first feather will show shades of orange or the next used hue in the HSB color space.
ResourceFunction["ImagePalettePlumes"] creates a new image in the "RGB" color space.
ResourceFunction["ImagePalettePlumes"] can take the following options:
"Excluded""BlackWhite"discards certain pixels from img
ImageSize1000the size of the output image
"PlumeCount"7the number of plumes, 0 ≤ n,n ∈ ℤ
Possible values for the "Excluded" option include:
None or "None"processes all of the pixels in img
"White"discards pixels close to white
"Black"discards pixels close to black
"BlackWhite"discards pixels close to either black or white
"GrayTones"discards all pixels with saturation values below 0.2
ndiscards all pixels with saturation values ≤ n
With "PlumeCount"0, the palette data is displayed in a more utilitarian rectangular format, with no feathers.
ResourceFunction["ImagePalettePlumes"] can take a long time to render. Downsizing the image first shortens the render time.

Examples

Basic Examples (2) 

Visualize the color palette an artist used in a painting (here, Frank Frazetta's Monster Out of Time). This may take a minute or more:


In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/c0b1feda-8622-4601-9ea3-6302cf024541"]
Out[1]=

Contrast that with another painting's palette (here, Comtesse d'Haussonville by Jean-Auguste-Dominique Ingress):


In[2]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/e13460d1-a2d1-4c94-9319-3f467e482632"]
Out[2]=

Options (3) 

Exclude sets of pixels based on their saturation and brightness values with the "Excluded" option. The painting here is Fishers by Natalia Goncharova:

In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/fdefaaaf-b215-4929-81d4-84c313dd4882"]
Out[3]=

ImageSize (1) 

Change the size of the output image. This painting is Irises by Vincent van Gogh:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/e9a45ce6-1865-43ad-b569-6f78fbc4546b"]
Out[4]=

PlumeCount (2) 

Change the number of plumes. This painting is Colorful Portrait by Svenja Jodicke:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/6b818c1a-44db-47af-a112-2acd2c9221d7"]
Out[5]=

The value of 0 has special meaning for the PlumeCount option. Instead of plumes, it shows the palette of colors spread out across a two-dimensional rectangular area. The horizontal axis is hue; the vertical axis is pixel values sorted by brightness. This is Vincent van Gogh's Starry Night:

In[6]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/6d50ea96-7392-4107-954b-a83b28e899a8"]
Out[6]=

Properties and Relations (2) 

Use ImageHistogram to visualize the number of pixels at a given intensity in each channel. It may be difficult to relate the histogram output to the colors in the image:

In[7]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/5c4c543c-6865-4bce-a80e-be30e3224298"]
Out[7]=

Use ImagePalettePlumes to see the distribution of the actual colors in the image. Here van Gogh moves abruptly from bright colors to dark outlines, which is shown by the thin dark edges of the feathers. Also the sky in the painting appears in the second and third plume as one of the painting's dominant colors, but that color would be difficult to identify in the histogram:

In[8]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/656d4f54-bdda-4a55-8f9c-9e40a4214afd"]
Out[8]=

Possible Issues (2) 

ImagePalettePlumes uses the HSB color space to order pixels, but the hue values for black, white, and gray are arbitrary:

In[9]:=
Column@Table[{Hue[h, 1, 1], Hue[h, .5, 0], Hue[h, 0, 1], Hue[h, 0, .5], "hue = " <> ToString[h]}, {h, 0, 1, .2}]
Out[9]=

In images that have significant amounts of black, white, or gray, use the "Excluded" option with a value of "GrayTones" or a value n > 0.3. (The painting below is All Went Still for the Moonrise by Karen Wysopal.):

In[10]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/9ed15096-00a7-4d27-8186-ec574695e972"]
Out[10]=

Neat Examples (1) 

Compare two paintings from Claude Monet's Haystacks series:

In[11]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/caa728ff-ef76-47df-93ee-01dd78e38ae4"]
Out[11]=

Publisher

Mark Greenberg

Version History

  • 1.0.0 – 30 August 2022

Related Resources

License Information