Recent

Author Topic: TBGRABitmap picture color correction  (Read 657 times)

DidaJI

  • New Member
  • *
  • Posts: 32
TBGRABitmap picture color correction
« on: June 08, 2021, 10:45:30 am »
Hi, I need help correcting the color of the whole picture. For example, I need to reduce the color red, etc.
I suppose it could be done with BGRAReplace(picture, picture.Filter......), but somehow I can't.
I can do, for example, a blur filter, rotation, resizing, but I can't change the color shade.

Can anyone give me an example of how to do this?

Thanks a lot, Zdenek.

winni

  • Hero Member
  • *****
  • Posts: 2486
Re: TBGRABitmap picture color correction
« Reply #1 on: June 08, 2021, 10:57:58 am »
Hi!

This example shows you how to reduce the red part with 128:
Code: Pascal  [Select][+][-]
  1. var img: TBGRABitmap;
  2. i : Integer;
  3. p: PBGRAPixel;
  4.  
  5. begin
  6. ....
  7.  p := img.data;
  8.     for i := 0 to  img.NbPixels -1  do
  9.         begin
  10.         if p^.red > 128 then p^.red := p^.red - 128 else p^.red := 0;
  11.        inc(p);
  12.         end;  
  13.  img.InvalidateBitmap;
  14. end;                    
  15.  
  16.  

Winni

DidaJI

  • New Member
  • *
  • Posts: 32
Re: TBGRABitmap picture color correction
« Reply #2 on: June 08, 2021, 12:39:05 pm »

 

TinyPortal © 2005-2018