/// <summary> /// Initializes a new instance of the Bytescout.PDF.Image class from the specified existing image. /// </summary> /// <param name="image" href="http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx">The System.Drawing.Image from which to create the new Bytescout.PDF.Image.</param> /// <param name="compression">The compression filter used for this image.</param> /// <param name="jpegQuality">The JPEG quality.</param> public Image(System.Drawing.Image image, ImageCompression compression, int jpegQuality) : this(image) { Compression = compression; if (compression == ImageCompression.DCT) { DCTDecoder.Encode(image, _dict.GetStream(), jpegQuality); } }
/// <summary> /// Initializes a new instance of the Bytescout.PDF.Image class from the specified data stream. /// </summary> /// <param name="stream" href="http://msdn.microsoft.com/en-us/library/system.io.stream.aspx">The data stream used to load the image.</param> /// <param name="compression">The compression filter used for this image.</param> /// <param name="jpegQuality">The JPEG quality.</param> public Image(Stream stream, ImageCompression compression, int jpegQuality) : this(stream) { Compression = compression; if (compression == ImageCompression.DCT) { System.Drawing.Image image = System.Drawing.Image.FromStream(stream); DCTDecoder.Encode(image, _dict.GetStream(), jpegQuality); image.Dispose(); } }