LEADTOOLS Support
Imaging
Imaging SDK Questions
How To: remove the certain color from a bitmap then save the separated part
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Saturday, October 13, 2007 3:45:01 AM(UTC)
Groups: Registered
Posts: 21
Hi,
I'm using leadtools v13.
ColorSeparate method can separate the bitmap by color plane to produce one grayscale bitmap per plane. But I want to remove the red color while keep the original palette. And I also want to save the removed part into a new bitmap just like only copy the red color from the original bitmap.
Is there any way to do this ?
Thanks
rick
#2
Posted
:
Tuesday, October 16, 2007 12:34:00 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Please explain in more details
what you're trying to do.
Do you want to identify pixels
that are in the red range of colors, or do you want to work with all pixels
that have a red component?
For example, the color RGB(200,
10, 10) is in the Red range, although it's not pure red. On the other hand, the
color RGB(255, 250, 240) contains much more of the Red component, but it is not
in the Red range at all.
Also, are you working with images that have 8 bits per pixel or less? If
not, the images would not have palettes in LEADTOOLS. If you are working with
palettized images, is it a requirement that the original image's palette be
completely preserved with no changes at all?
About removing the red color, what
exactly do you want to put in its place? Do you want to fill the affected parts
with a certain color such as black?
I would also like to know which LEADTOOLS programming
interface (OCX, .NET classes, DLL API, C++ Classes, etc.)
#3
Posted
:
Tuesday, October 16, 2007 5:40:32 PM(UTC)
Groups: Registered
Posts: 21
I think it should be the first way I want to deal with the bitmap (identify pixels those are in the red range of colors).
For example, as the images attached is concerned, I use method colorseparate(RGB) to process "original.bmp" , then I get red plane("ColorSep.bmp"). It looks like we "remove" the red color pixels from the bitmap.
Now I want to save the "removed" red pixels into a new bitmap. In another word, we need to create a new bitmap with same width and height against the original. Then we pick up the certain color (range) pixels from the original bitmap and fill them with the certain color in new bitmap.
There's nothing further need to be done with removed color in original bitmap.Method colorseparate works well. And It's not a requirement that the original image's palette should be completely preserved with no changes.
I use leadtools 13 main ocx and com. My dev tool is VB6.
Thanks
rick
#4
Posted
:
Wednesday, October 17, 2007 3:57:22 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You can use the following code:
Dim io As New LEADRasterIO
Dim proc As New LEADRasterProcess
io.Load LEADRasterView1.Raster,
"original.bmp", 0, 1, 1
MsgBox 1
LEADRasterView2.Raster.CreateBitmap
LEADRasterView1.Raster.BitmapWidth, LEADRasterView1.Raster.BitmapHeight,
LEADRasterView1.Raster.BitmapBits
proc.Fill LEADRasterView2.Raster, vbWhite
LEADRasterView1.Raster.SetRgnColorHSVRange
-25, 80, 90, 25, 255, 255, L_RGN_SET
proc.Combine LEADRasterView2.Raster, 0, 0,
LEADRasterView1.Raster.BitmapWidth, LEADRasterView1.Raster.BitmapHeight,
LEADRasterView1.Raster, 0, 0, CB_DST_0 + CB_OP_ADD
proc.Fill LEADRasterView1.Raster, vbWhite
#5
Posted
:
Wednesday, October 17, 2007 4:27:56 PM(UTC)
Groups: Registered
Posts: 21
It works!
Thank you very much.
Rdgs,
rick
LEADTOOLS Support
Imaging
Imaging SDK Questions
How To: remove the certain color from a bitmap then save the separated part
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.