Hi Kazu,
Thanks for your follow-up here!
Yes, you are correct, the Output Image File (or OutFile as from the API) option only saves the plot itself, without any scales, footnotes, or headers.
If you would like to use the extra info stored in the header/footnote as shown in the GUI, then you will need to pull that data from the API as discussed in this forum thread below:
How can I pull Peak Irradiance or Total Hits from the Detector Viewer analysis in the API? | Zemax Community
Then you will need to make your own plot in the API with the labels added separately.
Unfortunately, currently we do not directly support saving images from the API. The analogue to this function in the user interface (clicking the "Save" button in the GUI windows) isn't hooked up to the API. However, there is an existing feature request for this capability in our internal system. I have gone ahead and voted for this request on your behalf. Thank you for bringing this to our attention again.
Please keep in mind, that feature requests are weighed based on impact, difficulty to implement, and the number of users who request it. A request is not a guarantee that the feature will be added to a future release. However, these feature requests are very important to us and shape the future of OpticStudio, so we appreciate your input regarding desired functionality.
At this time, there is one possible workaround to this problem, but it will only work in the Interactive Extension. It will not work in a Standalone Application. The workaround involves a ZPL macro using keywords OPENANALYSISWINDOW and EXPORTJPG/EXPORTBMP. You will need to write a ZPLM operand which calls the ZPL macro using those keywords. Then add the ZPLM operand to your Merit Function, and update the Merit Function Editor. In this way, every time when the Merit Function is updated, the ZPL macro will run and an image will be saved. The drawback here is that the Merit Function is updated multiple times when an optimization is running. You will need to be careful about when you include the ZPLM operand and make sure to remove it before optimizing.
For further references please see these forum threads:
Automatically saving analysis windows with ZOS-API | Zemax Community
How to run macro via ZOSAPI | Zemax Community
Best regards,
Csilla