MATLAB: Do I receive an error when printing an image from a compiled MATLAB application

errorfailedget_paramgraphicsimageiofunlibraryMATLAB Compilermexmex fileparampdfprintprintingprivatetiffwtifc.dll

Why do I receive the error "ERROR: Failed to find MEX-File on path : iofun/private/wtifc.dll." when printing an image from a compiled MATLAB application?
I am unable to get my compiled MATLAB application to generate image files such as TIFF files. The MATLAB application works fine within MATLAB, but when I compile it, I receive the following error messages:
Failed to find MEX-File on path : iofun/private/wtifc.dll.
and
Function 'get_param' is not implemented in standalone mode.

Best Answer

The main reason this error occurs is because you are attempting to use an unsupported feature of the PRINT function in standalone mode. The MATLAB C/C++ Graphics Library currently only supports a limited number of flags or options with the PRINT function and the "-dtiff" option is not one of them.
Currently, to work around this issue:
1.) Save the figure to a bitmap file using the PRINT function with the -dbitmap option
2.) Read from the file using the IMREAD function
3.) Use IMWRITE to create the TIFF image
The example code below shows this workaround:
tmpfname = 'outfile';
print('-dbitmap', [tmpfname, '.bmp']);
[X, map] = imread( [tmpfname, '.bmp'] );
delete( [tmpfname, '.bmp'] );
imwrite(X, map, [tmpfname, '.tif'], , 'tiff','resolution',300);