Board index » delphi » Extract a channel (rgb) from a true color bitmap

Extract a channel (rgb) from a true color bitmap

Hi

I use bitmaps, pbytearray, and scanline to extract one of rgb components
from bitmap images (if true color 24bit).
I want know if is possible extract red,green and blue component image in
other way, I mean without using for, and scanline, like this:

for i:=0 to bmp.height-1 do
begin
 p:=bmp.scanline[i];
 for j:=0 to bmp.width-1 do
  begin
   k:=3*j;
   p_r:=p[k];
   p_g:=p[k+1];
   p_b=p[k+2];
 end;
end;

Any ideea? Or is ok that, cannot be optimized?

Thanx for any help

 

Re:Extract a channel (rgb) from a true color bitmap


Scanline is generally the fastest way.
It may depend on what your purpose is.
Do you need to access each pixels RGB values?
Or do you need to split the image into a new image containing only one of
the RGB components?
--
Finn Tolderlund

Quote
"Narcis" <developer%terrasoft.ro> wrote in message

news:3dbd00cc@newsgroups.borland.com...
Quote
> I use bitmaps, pbytearray, and scanline to extract one of rgb components
> from bitmap images (if true color 24bit).
> I want know if is possible extract red,green and blue component image in
> other way, I mean without using for, and scanline, like this:

Other Threads