Beispiel #1
0
        public static Size CalculateNewSize(object source, ResizeSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException("sourse");
            }

            if (source is Image || source is Bitmap)
            {
                return(CalculateNewSize(source as Image, settings));
            }

            Bitmap bitmap = null;

            try
            {
                bitmap = ImageBuilder.LoadImage(source);
                Size newSize = CalculateNewSize(bitmap as Image, settings);
                return(newSize);
            }
            finally {
                if (bitmap != null)
                {
                    bitmap.Dispose();
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Создает экземпляр ImageInfo
        /// </summary>
        /// <param name="source">"Источник может быть Uri, String, Bitmap, Image, Stream, byte[]"</param>
        /// <returns></returns>
        public static ImageInfo Build(object source)
        {
            Bitmap bitmap = ImageBuilder.LoadImage(source);

            return(new ImageInfo(bitmap));
        }