'Error in GDI+: 2 (Invalid Parameter)'.

my app goes well with Trial/Debug. Now, today downloaded full version, in Debug compilation, all is alright, but in Release, there is %subject% error somewhere in code (as in Release, I cannot find the place of error). Delphi 10.3.3 CE, Windows 10 64bit CZ (updated). App is commandline utility to generate some xls files from xml feed.

Could anyone help ?

Sadly all GDI+ commands are always "out of memory" or "invalid parameter" so the messages doesn't really help figuring out what is wrong.

One thing that can normally cause this is an image that GDI+ cannot process (maybe because it is corrupt, too big, or in a format GDI+ doesn't understand). Do you have any images in the files you are exporting? If so, are the same images used in debug and release?

Is there any difference between you code in debug and release? (some $IFDEF somewhere, or different data?) Because there shouldn't be any difference between both.

Also, are you generating xls only, or also pdf? Normally this error should happen when rendering a file (to pdf, html, etc), but not that much when generating xls/x files.
If the code is not too big, can you try commenting out parts of it until it doesn't crash in release so we can get a better idea of what is causing the crash? Start with anything doing graphics work since this is a GDI+ error: Adding images, autosizing columns, etc.

Hi Adrian,
Yes, I add images. Same for debug/release should be. No IFDEF RELEASE, this utility is realy simple, one file (using generics, oXML, flexcell). Both are Win64 target. Only XLS in this moment.

Ok, I could try to comment out some parts (images, merge cells, add border to cells, some functions (exported to excel).


It is 99% likely to be the images you add. Try commenting that out, and if it is that, please send me one image causing the problem, either here or to adrian@tmssoftware.com

it seemslike there was bad image - the same capacity, but other binary content (I tried to compare all files in debug/release by content). Problem was gone for this moment. I will test it deeply (download new data from customer and make some test for jpegs are good).
Many thanks.