[[ Bugfix 13706 ]] Fix a bug in the image saving code causing stackfile corruption
Merge pull request #1289 from runrevfraser/bugfix-13706

[[ Bugfix 13706 ]] Fix a bug in the image saving code causing stackfile ...