public Image(PDF pdf, JPGImage jpg) { this.w = (float)jpg.GetWidth(); this.h = (float)jpg.GetHeight(); this.size = jpg.GetFileSize(); Stream inputStream = jpg.GetInputStream(); if (jpg.GetColorComponents() == 1) { this.AddImage(pdf, inputStream, ImageType.JPG, this.w, this.h, this.size, "DeviceGray", 8); } else { if (jpg.GetColorComponents() == 3) { this.AddImage(pdf, inputStream, ImageType.JPG, this.w, this.h, this.size, "DeviceRGB", 8); } else { if (jpg.GetColorComponents() == 4) { this.AddImage(pdf, inputStream, ImageType.JPG, this.w, this.h, this.size, "DeviceCMYK", 8); } } } inputStream.Dispose(); }
/** * Use of this constructor will result in reduced memory consumption and faster processing, however it currently only supports JPG images. * Please see Example_24 */ public Image(PDF pdf, JPGImage jpg) { this.w = jpg.GetWidth(); this.h = jpg.GetHeight(); this.size = jpg.GetFileSize(); Stream stream = jpg.GetInputStream(); if (jpg.GetColorComponents() == 1) { AddImage(pdf, stream, ImageType.JPG, w, h, size, "DeviceGray", 8); } else if (jpg.GetColorComponents() == 3) { AddImage(pdf, stream, ImageType.JPG, w, h, size, "DeviceRGB", 8); } else if (jpg.GetColorComponents() == 4) { AddImage(pdf, stream, ImageType.JPG, w, h, size, "DeviceCMYK", 8); } stream.Dispose(); }