static void saveTheImage(Image saveimage, int imageIndex, DocToImagesOptions options, ImageSaveParams isp)
        {
            string outputfilepath;

            if (options.getoutputdir() != "")
            {
                outputfilepath = options.getoutputdir() + "/" + options.getoutputfile() +
                                 formatdigits(options.getZeroSuffix(), imageIndex);
            }
            else
            {
                outputfilepath = options.getoutputfile() + formatdigits(options.getZeroSuffix(), imageIndex);
            }

            outputfilepath = CreateFileSuffix(outputfilepath, options.getoutputformat());
            try
            {
                saveimage.Save(outputfilepath, options.getoutputformat(), isp);
                saveimage.Dispose();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cannot write an image to a file: " + ex.Message);
            }
        }