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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Add Text Layer to large TIF - eOutOfResources
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

caryals

USA
2 Posts

Posted - Mar 17 2022 :  12:47:54  Show Profile  Reply

I am encountering a resource issue merging a text layer to the top of an image using 64bit 10.2.0 library. From another post I tried setting location to file. I included some sample and image information. Any suggestions?

procedure test;
  var
   FIEView: TImageEnView;
  begin
    FIEView := TImageEnView.Create(nil);
    try
      IEGlobalSettings().DefMinFileSize := -1;
      FIEView.fIEBitmap.MinFileSize := 0;
      FIEView.fIEBitmap.Location := iefile;
      FIEView.fIEBitmap.ParamsEnabled := true;
      FIEView.IO.LoadFromFile('c:\workarea\a.tif');
      FIEView.Proc.ImageResize(0, 450, 0, 0);
      //review orig image adjusted
      FIEView.Update();
      FIEView.IO.SaveToFile('c:\workarea\a-1.tif');

      //Image.IEView.LayersAdd(ielkText);
      FIEView.LayersAdd('Adding Text', 42, clBlack,'Arial', []);
      FIEView.LayersMergeAll(); //eOutOfResources  The parameter is incorrect
      FIEView.Update(); FIEView.IO.SaveToFile('c:\workarea\a-2.tif');

    finally
      FIEView.Free;
    end;

  end;




Thanks,
Andrew



Andrew Ryals

xequte

38295 Posts

Posted - Mar 17 2022 :  21:53:32  Show Profile  Reply
Hi Andrew

Text output requires a canvas, which means that the location has to be converted to TBitmap. Naturally TBitmap is not great with resource handling.

Try drawing the texting with FIEView.Proc.TextOut(). Though I expect that will still fail because it still requires a canvas.

https://www.imageen.com/help/TImageEnProc.TextOut.html


The final solution is to output the text to a TIEBitmap, and the draw the bitmap on your large bitmap. This will avoid usage of the canvas on the large bitmap and should resolve the issue:

https://www.imageen.com/help/TIEBitmap.DrawToTIEBitmap.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

caryals

USA
2 Posts

Posted - Mar 18 2022 :  02:12:26  Show Profile  Reply
Thank you Nigel. Option 1 failed. Option 2 worked.

Andrew Ryals
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: