Hello:
This tutor will show some routines I have developed to filter colors on images.

This is only a sample to introduce the concepts, it is not a finished program, it will only allow for 32bppArgb and 24bppArgb pixelformats, so if you want other formats you need to modify a little the routines to include your format.

In a normal picture, you don't have a clear edge between shapes or colors: if I stand beside a blue wall, my skin will have some blue reflected from the wall, if I am in a bright place, the edge between my arm and the background won't be perfectly delimited.

If I cut a color, the edges will have some shades of different color, and will not be smooth. A drawing of a cartoon character will have better edges, because the limits will be well defined and the colors won't have too much variation.

My program allows to select a color by clicking on picture1 and, depending on the values of the numeric up-downs, a range of colors will be selected, having the selected color in middle and the ranges of red, green and blue from lower to higher included. The program shows on the label with a gradient background, and the range values shown.

By lowering the value of the numeric up-downs, I have more precise colors when cropping, but some shades won't be included. By increasing, it will include more shades of a color, but will also capture colors on the range, that won't look similar to the desired one.
Remember, to construct a color we need 3 components, red, green and blue. Green will be 0,G,0. Where G could have any value from 0 to 255. 0 for the darkest, 255 for the brightest. So if I have 0,188,0 , this is green, same as 0,120,0. But if I have any red or blue component like: 25,204,13, still looks green, but is not green. A forest have a lost of greens, but little pure greens.

Here I have some examples of croping:

The original image on picture1 can be preserved while copying colors to picture2, or the colors cut and tranferred to picture2.

Also it is possible to add colors to the resulting image.

The tooltips will give some information on what to do, but the best way is to experiment. I have included a label that shows the color under the mouse to make it easier to select a color, a routine to save results, and a pixelformat detection routine.
Also there is a couple of undo's for picturebox1, when transferring colors, so you don't have to reload the image.
The adding to the second picture selection should be done after a first transfer or copy, so you have a clear image and white areas, with a color showing. If you don't do that you will have the first picture copied to the second, and won't note the difference.

You can save the partial results on picture1 or picture2 using this routine that will save them on sequential numbering in the program directory.

Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
Dim i As Integer
Dim str As String = ""
For i = 1 To 1000
If i < 10 Then str = "Picture_00" & i.ToString & ".jpg"
If i > 9 And i < 100 Then str = "Picture_0" & i.ToString & ".jpg"
If i > 99 Then str = "Picture_" & i.ToString & ".jpg"
If i > 900 Then MsgBox("You Have Over 900 Pictures, Please Check And Delete Unnecesary Ones")
If Not System.IO.File.Exists(str) Then
Try
PictureBox1.Image.Save(str, System.Drawing.Imaging.ImageFormat.Jpeg) 'Cropped
Catch Ex As Exception
MsgBox("Could Not Write To Location")
End Try
Exit For
End If
Next
End Sub