Exemple #1
0
            public JpegImageResize (Stream imageStream)
            {
                m_originalImage = Image.FromStream (imageStream);
                m_originalImage.InitializeLifetimeService ();
                m_originalWidth = m_originalImage.Width;
                m_originalHeight = m_originalImage.Height;
                m_imageSize = new Dictionary<string, Size_XYOffset> ();
                m_imageResultDictionary = new Dictionary<string, MemoryStream> ();
                m_imageSize ["100"] = validateAndReturnImageSize_XYOffset (100, 100, 0, 0, m_originalWidth, m_originalHeight);
                m_imageSize ["320"] = validateAndReturnImageSize_XYOffset (320, 240, 0, 0, m_originalWidth, m_originalHeight);
                m_imageSizeProportionalToWidth_XYOffsetArray = new Width_XYOffset[] { 
                new Width_XYOffset(150, 0, 0),
                new Width_XYOffset(200, 0, 0),
                new Width_XYOffset(500, 0, 0),
            };
                try {
                    IEnumerator imageWidthEnumerator = m_imageSizeProportionalToWidth_XYOffsetArray.GetEnumerator ();
                    while (imageWidthEnumerator.MoveNext()) {
                        AddImageSizeProportionalToWidth_XYOffset ((Width_XYOffset)imageWidthEnumerator.Current);
                    }

                } catch (Exception e) {
                    Console.WriteLine (e.Message);
                }
            }