Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to separate an image into multiple layers based on color
#1
Hi Everyone,

First post.

I would like to know if there is a way to separate an image into multiple layers based on color (or pallet)?

I have created an image with Filter -> Render -> Clouds -> Difference Clouds

   

Then I apply the Color -> Posterize effect to make the image look like a terrain map

   

Now I would like to automatically split each color into its own layer (so this image should be about 8 or 9 layers).

Any suggestions would be most appreciated!!!

Thank you,
jpummill
Reply
#2
There will be a few ways I am sure. My first thoughts.

(1) Posterizing still leaves a bit of a messy image. Using Colors -> Info -> Colorcube Analysis shows 146 shades.
(2) A better way might be Colors -> Map -> Palette Map  using a suitable palette. I will attach the one I used, might be useful (or not)

   

(3) I used gimp_gmic_qt see: http://www.gmic.eu to separate those. 
(4) The layers with a couple of them visible.

   


Attached Files
.zip   BitGrayscale.gpl.zip (Size: 1.29 KB / Downloads: 166)
Reply
#3
If the colors can be separated by their luminosities (or this is a grayscale image) then:

* Add a layer mask to the image, and initialize to Grayscale copy of layer
* Make as many copies of this as you want images
* Use the threshold tool on the mask to keep opaque only the range of values for the image (the threshold tool has two handles and defines a range).

In the example below, since the spectrum of the solid noise is a bit restricted, I used wider ranges at both ends

   

   
Reply
#4
Only a simple comment on Rich's post about "Posterize" in Gimp.
I guess that recent releases of Gimp have a proper handling of Posterizing effect.
After having run Gimp Posterize on an image I found (thru Histogram) that the values are really only n, without messy values around the peaks.
I'm referring to Gimp 2.10.19 Samj's.
Reply
#5
(04-27-2020, 05:47 AM)dinasset Wrote: Only a simple comment on Rich's post about "Posterize" in Gimp.
I guess that recent releases of Gimp have a proper handling of Posterizing effect.
After having run Gimp Posterize on an image I found (thru Histogram) that the values are really only n, without messy values around the peaks.
I'm referring to Gimp 2.10.19 Samj's.

SamJ's somehow versioning is independent of Gimp"s versioning.

However, using my 2.10.14, if I apply Posterize to a I-8 and FP-32 versions of the same grayscale image I get the same histogram with sharp values, However, when I ask for 8 colors I only get 6 spikes...

OTOH the colorcube analysis still reports 199 (FP-32) or 198 (I-8) colors, and if I color-index the I-8 image, I get a colormap with 198 entries...
Reply
#6
Used OP's posterized image. Must have been scrambled on download.
Reply
#7
(04-27-2020, 06:42 AM)rich2005 Wrote: Used OP's posterized image. Must have been scrambled on download.

The OP's posterized image is a JPEG. JPEG compression will create new colors.
Reply
#8
(04-27-2020, 06:44 AM)Ofnuts Wrote:
(04-27-2020, 06:42 AM)rich2005 Wrote: Used OP's posterized image. Must have been scrambled on download.

The OP's posterized image is a JPEG. JPEG compression will create new colors.

Lets hope that OP is not using that one then. Wink
Reply
#9
(04-27-2020, 06:46 AM)rich2005 Wrote:
(04-27-2020, 06:44 AM)Ofnuts Wrote:
(04-27-2020, 06:42 AM)rich2005 Wrote: Used OP's posterized image. Must have been scrambled on download.

The OP's posterized image is a JPEG. JPEG compression will create new colors.

Lets hope that OP is not using that one then. Wink

Hey Everyone, I wanted to thank all of you for taking the time to provide input on my question.

Sorry about the image provided being a JPEG.  I didn't think about the ramifications regarding color.  I am still using Gimp 2.8 and my posterize seemed to be working correctly.

I'm looking for a way to automate the process.  I would like to create a python-fu script to create the original image, posterize it, and then split it into separate layers.  I would then like to bump map each layer and create a drop shadow for each layer.

Ultimately, I am trying to create the following type image (and then automate the process).

   

Thanks again for your useful comments!!!
Reply
#10
(04-27-2020, 03:30 PM)jpummill Wrote:
(04-27-2020, 06:46 AM)rich2005 Wrote:
(04-27-2020, 06:44 AM)Ofnuts Wrote: The OP's posterized image is a JPEG. JPEG compression will create new colors.

Lets hope that OP is not using that one then. Wink

Hey Everyone, I wanted to thank all of you for taking the time to provide input on my question.

Sorry about the image provided being a JPEG.  I didn't think about the ramifications regarding color.  I am still using Gimp 2.8 and my posterize seemed to be working correctly.

I'm looking for a way to automate the process.  I would like to create a python-fu script to create the original image, posterize it, and then split it into separate layers.  I would then like to bump map each layer and create a drop shadow for each layer.

Ultimately, I am trying to create the following type image (and then automate the process).



Thanks again for your useful comments!!!

The technique I explained with thresholded layer masks is inspired by one of my scripts, which is demonstrated here:

http://gimpchat.com/viewtopic.php?f=9&t=9311

The script is here: https://sourceforge.net/projects/gimp-to...y/download

Some doc at the bottom of this page: http://gimp-tools.sourceforge.net/tools.shtml

80% of the script can be reused. In fact you just have to remove the pixellation step and the tiles images and use hard-wired values for the thresholds (or your own algorithm/heuristic).  You have to add the drop-shadow (easy to script) and perhaps the smoothing of the curve (but then upscaling noise should do it).
Reply


Forum Jump: