public bool ProcessImage(string sourceFile, string destinationFile, int timeout, int width, int height,
			ContentAwareResizeFilterConvolutionType convolutionType)
        {
            string runArguments = " -I \"" + sourceFile + "\" -O \"" + destinationFile + "\" -T 1 -C " + convolutionType;
            runArguments += " -X " + width;
            runArguments += " -Y " + height;

            if (!File.Exists(CairPath))
                throw new DynamicImageException("Could not find CAIR.exe. This file needs to be in ~/App_Data/DynamicImage.");

            ProcessStartInfo info = new ProcessStartInfo(CairPath, runArguments)
            {
                UseShellExecute = false,
                RedirectStandardInput = true,
                RedirectStandardError = true,
                RedirectStandardOutput = true,
                CreateNoWindow = true
            };
            using (Process scr = Process.Start(info))
            {
                bool result = scr.WaitForExit(timeout);
                if (!result)
                    scr.Kill();
                return result;
            }
        }
예제 #2
0
        public bool ProcessImage(string sourceFile, string destinationFile, int timeout, int width, int height,
                                 ContentAwareResizeFilterConvolutionType convolutionType)
        {
            string runArguments = " -I \"" + sourceFile + "\" -O \"" + destinationFile + "\" -T 1 -C " + convolutionType;

            runArguments += " -X " + width;
            runArguments += " -Y " + height;

            var info = new ProcessStartInfo(_cairPath, runArguments)
            {
                UseShellExecute        = false,
                RedirectStandardInput  = true,
                RedirectStandardError  = true,
                RedirectStandardOutput = true,
                CreateNoWindow         = true
            };

            using (Process scr = Process.Start(info))
            {
                bool result = scr.WaitForExit(timeout);
                if (!result)
                {
                    scr.Kill();
                }
                return(result);
            }
        }
예제 #3
0
        public bool ProcessImage(string sourceFile, string destinationFile, int timeout, int width, int height,
			ContentAwareResizeFilterConvolutionType convolutionType)
        {
            string runArguments = " -I \"" + sourceFile + "\" -O \"" + destinationFile + "\" -T 1 -C " + convolutionType;
            runArguments += " -X " + width;
            runArguments += " -Y " + height;

            var info = new ProcessStartInfo(_cairPath, runArguments)
            {
                UseShellExecute = false,
                RedirectStandardInput = true,
                RedirectStandardError = true,
                RedirectStandardOutput = true,
                CreateNoWindow = true
            };
            using (Process scr = Process.Start(info))
            {
                bool result = scr.WaitForExit(timeout);
                if (!result)
                    scr.Kill();
                return result;
            }
        }
예제 #4
0
 public ContentAwareResizeFilterBuilder ConvolutionType(ContentAwareResizeFilterConvolutionType convolutionType)
 {
     Filter.ConvolutionType = convolutionType;
     return(this);
 }