How do I programatically save a chart picture?

 

The MetaTrader menu has a File > Save as Picture > Active Chart (as is) command that manually saves a snapshot of the current chart to a specified directory.

How can that be done with MQL4 code?

 
Reason: