WX Pack - (OCR Component) - How can I assign an image from the clipboard instead of Loading one?

Win7, Delphi 11.2, VCL, TMS WX Pack, using the TTMSFNCWXOCR v1.1.4.7 OCR component.

I have some ideas for using the OCR component and have been testing it out since yesterday, 3/28. Loading images via the ocr1.RecognizeFile(); works fine, but searching for images with text can be a chore.

I have various screenshots I've made over the years in hopes of using with an OCR some day--that day is today, and I am highlighting some of the text portions with a rubber-band feature that copies portions of an image that I select to the clipboard. Then, I use the image1.picture.assign(clipboard) method to add to my form's timage for viewing.

But, I can't seem to figure out how to assign an image (from the clipboard) to your OCR component for text processing the same way or similar, as in the above.

Is this possible?

Hi,

We will add a feature to the component to enable starting the OCR from a bitmap. Meanwhile
you could use the following code to get the image from the clipboard and start the OCR.

procedure TForm1.Button1Click(Sender: TObject);
var
  b: TTMSFNCBitmap;
begin
  b := TTMSFNCClipBoard.GetBitmap;
  TMSFNCWXOCR1.RecognizeBase64(TTMSFNCUtils.SaveBitmapToBase64(b), 'clipboardimage');
end;

You can also use the TTMSFNCWXOCRHelper to show the image and start the ocr from there:

procedure TForm1.Button1Click(Sender: TObject);
var
  b: TTMSFNCBitmap;
begin
  b := TTMSFNCClipBoard.GetBitmap;
  TMSFNCWXOCRHelper1.Bitmap.Assign(b);
  TMSFNCWXOCRHelper1.StartFullImageOCR;
end;

You can read more about that component here: TTMSFNCWXOCRHelper - TMS FNC WX Pack

Hi. This appears to work okay.

var
  b: TTMSFNCBitmap;
begin
  // paste clipboard image to component for ocr processing.
  b := TTMSFNCClipBoard.GetBitmap;
  OCR1.RecognizeBase64(TTMSFNCUtils.SaveBitmapToBase64(b), 'clipboardimage');

  TMSFNCWXOCRHelper1.Bitmap.Assign(b);
  TMSFNCWXOCRHelper1.StartFullImageOCR;

  im1.Picture.Assign(clipboard);
end;

Thank you so much for the quick response and solution!!