示例#1
0
        public bool EmptyForm(ImageFile imgFile, int imageWidth, int imageHeight, string drawString)
        {
            //ImageFile imgFile = new ImageFile(imageFileName);
            ImageFile tempFile = new ImageFile(Path.GetTempPath() + "i" + DateTimeOffset.UtcNow.UtcTicks.ToString("x") + ".png");

            // example: convert -size 180x225 xc:white -fill 292990_01_Gallery.png -draw "circle 30,110 32,82" -fuzz 5% -trim CircleW.png
            callString = ImPath + ConvertCommand + " -size " + imageWidth + "x" + imageHeight +
                         " xc:white -fill " + Os.Escape(imgFile.FullName, EscapeMode.paramEsc) +
                         " -draw \"" + drawString + "\" -fuzz 50% -trim " + Os.Escape(tempFile.FullName, EscapeMode.paramEsc);
            call = new RaiSystem(callString);
            string msg = new string(' ', 200);;

            call.Exec(out msg);
            try
            {
                File.Delete(tempFile.FullName);
            }
            catch (Exception)
            {
            }
            if (msg.Contains("geometry does not contain image"))
            {
                return(true);
            }
            return(false);
        }
示例#2
0
        public int Histogram(string imageFile, string histogramFileName)
        {
            string commandline = " -format %c " + Os.Escape(imageFile, EscapeMode.paramEsc) + " -colors 32 -depth 8 histogram:info:" + Os.Escape(histogramFileName, EscapeMode.paramEsc);

            call = new RaiSystem(ImPath + ConvertCommand, commandline);
            call.Exec();
            return(call.ExitCode);
        }