Recent

Author Topic: Bitmap.Monochrome  (Read 5087 times)

timurgepard

  • Newbie
  • Posts: 4
Bitmap.Monochrome
« on: August 01, 2011, 11:34:27 am »
Good Day!

"image1.Picture.Bitmap.Monochrome:=true" doesn't work.

Picture stays without changes.

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  try
  if OpenPictureDialog1.Execute
  then
   begin
    image1.Picture.LoadFromFile(OpenPictureDialog1.Filename);
    with image1 do
     begin
      Parent:=form1;
      Picture.Bitmap.Monochrome:=true;
     end;
   end;
 except ShowMessage('Неизвестная ошибка');
 end;
end; 

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Bitmap.Monochrome
« Reply #1 on: August 01, 2011, 05:31:55 pm »
Monochrome is more to read information about the bitmap, not to modify it into being monochrome...

To change a image to monochrome I'd use TLazIntfImage and then loop through all pixels changing their color to the adequate grey tone. See more details here:

http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Conversion_between_TLazIntfImage_and_TBitmap

lainz

  • Guest
Re: Bitmap.Monochrome
« Reply #2 on: August 01, 2011, 06:02:16 pm »
Use BGRABitmap.FilterGrayScale
http://wiki.lazarus.freepascal.org/BGRABitmap

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: Bitmap.Monochrome
« Reply #3 on: August 02, 2011, 11:13:38 am »
Good Day!

"image1.Picture.Bitmap.Monochrome:=true" doesn't work.

pleae bugrep this. IMO it should convert the image to monochrome
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker