/// <summary> /// this will handle also large bitmaps and show a thumbnailed version on a picturebox /// see http://blog.opennetcf.com/ctacke/2010/10/13/LoadingPartsOfLargeImagesInTheCompactFramework.aspx /// </summary> /// <param name="sFileName">the name of the file to load</param> private void showImage(string sFileName) { var stream = File.Open(sFileName, FileMode.Open); m_stream = new StreamOnFile(stream); m_size = ImageHelper.GetRawImageSize(m_stream); System.Diagnostics.Debug.WriteLine("showImage loading " + sFileName + ", width/height = " + m_size.Width.ToString() + "/" + m_size.Height.ToString()); //CameraPreview.Image = ImageHelper.CreateThumbnail(m_stream, CameraPreview.Width, CameraPreview.Height); CameraSnapshot.Image = ImageHelper.CreateThumbnail(m_stream, CameraPreview.Width, CameraPreview.Height); showSnapshot(true); m_stream.Dispose(); stream.Close(); }
/// <summary> /// Loads specified image property from the given image /// </summary> /// <param name="imagePath">path to the image file</param> /// <param name="property">Property tag</param> /// <returns>Property</returns> public static ImageProperty LoadProperty(string imagePath, ImageTag property) { if (imagePath == null) { throw new ArgumentNullException(); } StreamOnFile st = new StreamOnFile(imagePath); IImageDecoder decoder = null; ImagingFactory factory = new ImagingFactoryClass(); factory.CreateImageDecoder(st, DecoderInitFlag.DecoderInitFlagNone, out decoder); return(LoadProperty(decoder, property)); }
/// <summary> /// this will handle also large bitmaps and show a thumbnailed version on a picturebox /// see http://blog.opennetcf.com/ctacke/2010/10/13/LoadingPartsOfLargeImagesInTheCompactFramework.aspx /// </summary> /// <param name="sFileName">the name of the file to load</param> private void showImage(string sFileName) { var stream = File.Open(sFileName, FileMode.Open); m_stream = new StreamOnFile(stream); m_size = ImageHelper.GetRawImageSize(m_stream); System.Diagnostics.Debug.WriteLine("showImage loading " + sFileName + ", width/height = " + m_size.Width.ToString() + "/"+ m_size.Height.ToString()); //CameraPreview.Image = ImageHelper.CreateThumbnail(m_stream, CameraPreview.Width, CameraPreview.Height); CameraSnapshot.Image = ImageHelper.CreateThumbnail(m_stream, CameraPreview.Width, CameraPreview.Height); showSnapshot(true); m_stream.Dispose(); stream.Close(); }