Esempio n. 1
0
        private static bool GenerateThumb(string filename, string destname, int _LorS)
        {
            bool _returnStatus = false;

            if (File.Exists(destname))
            {
            }
            using (MagickImage image = new MagickImage(filename))
            {
                double dw = 1;
                if (_LorS == 1)
                {
                    dw = (double)LargeThumbSize / image.Width;
                }
                if (_LorS == 0)
                {
                    dw = (double)SmallThumbSize / image.Width;
                }

                image.FilterType = FilterType.Box;
                image.Thumbnail((int)(image.Width * dw), (int)(image.Height * dw));

                if (!ServiceProvider.Settings.DisableHardwareAccelerationNew)
                {
                    image.UnsharpMask(1, 1, 0.5, 0.1);
                }

                PhotoUtils.CreateFolder(destname);
                image.Write(destname);
                image.Dispose();

                _returnStatus = true;
            }
            return(_returnStatus);
        }