Skip to main content

I want to use ZPL to save the graphic result from 'Partially Coherent Image Analysis'. Could you tell me what the correct macro command to use? An example code will be very helpful. Thanks!

Hi Zhiguang,



You can use EXPORTJPG or EXPORTBMP to export the graphics of a window to the respective file formats. The syntax is the same for either:



EXPORTBMP winnum, 'C:\temp\fileoutput'



You'll have to keep track of window numbers to have winnum available, but if you run the ZPL code from the same overall layout of windows each time, the window with the Partially Coherent Image Analysis should be numbered the same each time.



Kevin


Hi Kevin,



Thanks a lot for your reply. I appreciate your help. I tried the command you recommended and it can save the graphic as bmp, but the image saved this way has much smaller size than the one I mannually saved (simply using the save as in the window). For instance, the size could be 1M vs. 4M, and thus the resolution will be different. Is there any way to use ZPl command to achieve bmp file with the same resolution as manually saved one?



Zhiguang


Hi Zhiguang,



Changing the resolution for EXPORTJPG is currently not supported in OpticStudio. The EXPORTJPG function is actually taking a screenshot of what is currently on the screen and does not call an external library to render it with a custom resolution. So, the resolution of the window can be changed manually in the UI, but this may defeat the purpose of using the macro in the first place.





 



Another option would be to use EXPORTBMP which would give a higher resolution image than a JPG.



 



The idea of changing the resolution for the EXPORTJPG and EXPORTBMP has been brought up before by other users too, so there is an open feature request for it. I have gone ahead and added your name to that feature request.



Please keep in mind that feature requests are weighed based on impact, difficulty to implement and 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 Zemax OpticStudio, so we appreciate your input.



Apologies for the inconvenience, and we will make sure to let you know if we implement this in a future version of OpticStudio.



Thanks,



Csilla


Hi Csilla,



Thanks a lot for your response, as well as including me in the feature request. I appreciate it.



Zhiguang


Reply