ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 AfterAcquireBitmap error

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
graphman Posted - Jan 18 2013 : 17:19:30
At this event I see
ImageEnMIO->Params[0]->SamplesPerPixel = 3
and
ImageEnMIO->Params[0]->BitsPerSample = 8

for ALL images 1bit, 8bit and 24 bit

How to fix it?
7   L A T E S T    R E P L I E S    (Newest First)
graphman Posted - Jan 29 2013 : 11:24:34
thanks
fab Posted - Jan 25 2013 : 00:16:46
Unfortunately SamplesPerPixel and BitsPerSample properties are set just after AfterAcquireBitmap returns.
For this reason you may set these parameters manually, example:

procedure TForm1.ImageEnMView1MIOOnAfterAcquireBitmap(Sender:TObject; index:integer);
begin
  case ImageEnMView1.ImageBitCount[index] of
    1:
      begin
        ImageEnMView1.MIO.Params[index].BitsPerSample := 1;
        ImageEnMView1.MIO.Params[index].SamplesPerPixel := 1;
      end;
    24:
      begin
        ImageEnMView1.MIO.Params[index].BitsPerSample := 8;
        ImageEnMView1.MIO.Params[index].SamplesPerPixel := 3;
      end;
  end;
end;
graphman Posted - Jan 22 2013 : 15:58:04
I scan black-and-white image and see SamplesPerPixel and BitsPerSample = 8:3
instead of 8:1

Why?
How to fix?
I need to get these parameters only (AfterAcquireBitmap event)
fab Posted - Jan 22 2013 : 10:47:16
It is strange SamplesPerPixel and BitsPerSample are set when the image is loaded. So if they are 8:3 it means the image is loaded/acquired as RGB, not black/white.
Please note that if you change the bitmap pixelformat manually the parameters SamplesPerPixel and BitsPerSample must be changed also.
graphman Posted - Jan 19 2013 : 09:29:32
At this event I copy image to ImageEnView and I want to get correct color parameters, but I see parameters like for 24 bit image.

ImageEnMIO->Params[index]->SamplesPerPixel = 3
ImageEnMIO->Params[index]->BitsPerSample = 8

always !!!
graphman Posted - Jan 19 2013 : 09:24:36
I need to get Black@White image, but I see only
ImageEnMIO->Params[0]->SamplesPerPixel = 3
and
ImageEnMIO->Params[0]->BitsPerSample = 8

At this event for black images I se parameters like color images.
w2m Posted - Jan 19 2013 : 06:53:32
Your code only handles the first image and it only sets the IO.Params. To fix this use the index to set the IO.Params and also use ConvertTo24Bit:

procedure TForm1.ImageEnMIO1AfterAcquireBitmap(Sender: TObject; index: Integer);
begin
  ImageEnMIO1.Params[index].SamplesPerPixel := 3;
  ImageEnMIO1.Params[index].BitsPerSample := 8;
  ImageEnProc1.ConvertTo24Bit;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html