public static ImageData CreateJpeg2000(byte[] bytes) { ValidateImageType(bytes, ImageType.JPEG2000); ImageData image = new Jpeg2000ImageData(bytes); Jpeg2000ImageHelper.ProcessImage(image); return(image); }
public static ImageData CreateJpeg2000(Uri url) { ValidateImageType(url, ImageType.JPEG2000); ImageData image = new Jpeg2000ImageData(url); Jpeg2000ImageHelper.ProcessImage(image); return(image); }
public virtual void OpenJpeg2000_2() { ImageData img = ImageDataFactory.Create(sourceFolder + "WP_20140410_001.JPC"); Jpeg2000ImageHelper.ProcessImage(img); NUnit.Framework.Assert.AreEqual(2592, img.GetWidth(), 0); NUnit.Framework.Assert.AreEqual(1456, img.GetHeight(), 0); NUnit.Framework.Assert.AreEqual(8, img.GetBpc()); }
public virtual void OpenJpeg2000_1() { try { ImageData img = ImageDataFactory.Create(sourceFolder + "WP_20140410_001.JP2"); Jpeg2000ImageHelper.ProcessImage(img); } catch (iText.IO.IOException e) { NUnit.Framework.Assert.AreEqual(iText.IO.IOException.UnsupportedBoxSizeEqEq0, e.Message); } }
public static ImageData CreateJpeg2000(byte[] bytes) { byte[] imageType = ReadImageType(bytes); if (ImageTypeIs(imageType, jpeg2000_1) || ImageTypeIs(imageType, jpeg2000_2)) { ImageData image = new Jpeg2000ImageData(bytes); Jpeg2000ImageHelper.ProcessImage(image); return(image); } throw new ArgumentException("JPEG2000 image expected."); }
private static ImageData CreateImageInstance(byte[] bytes, bool recoverImage) { ImageType imageType = ImageTypeDetector.DetectImageType(bytes); switch (imageType) { case ImageType.GIF: { GifImageData image = new GifImageData(bytes); GifImageHelper.ProcessImage(image, 0); return(image.GetFrames()[0]); } case ImageType.JPEG: { ImageData image = new JpegImageData(bytes); JpegImageHelper.ProcessImage(image); return(image); } case ImageType.JPEG2000: { ImageData image = new Jpeg2000ImageData(bytes); Jpeg2000ImageHelper.ProcessImage(image); return(image); } case ImageType.PNG: { ImageData image = new PngImageData(bytes); PngImageHelper.ProcessImage(image); return(image); } case ImageType.BMP: { ImageData image = new BmpImageData(bytes, false); BmpImageHelper.ProcessImage(image); return(image); } case ImageType.TIFF: { ImageData image = new TiffImageData(bytes, recoverImage, 1, false); TiffImageHelper.ProcessImage(image); return(image); } case ImageType.JBIG2: { ImageData image = new Jbig2ImageData(bytes, 1); Jbig2ImageHelper.ProcessImage(image); return(image); } default: { throw new iText.IO.IOException(iText.IO.IOException.ImageFormatCannotBeRecognized); } } }
private static ImageData CreateImageInstance(byte[] bytes, bool recoverImage) { byte[] imageType = ReadImageType(bytes); if (ImageTypeIs(imageType, gif)) { GifImageData image = new GifImageData(bytes); GifImageHelper.ProcessImage(image, 0); return(image.GetFrames()[0]); } else { if (ImageTypeIs(imageType, jpeg)) { ImageData image = new JpegImageData(bytes); JpegImageHelper.ProcessImage(image); return(image); } else { if (ImageTypeIs(imageType, jpeg2000_1) || ImageTypeIs(imageType, jpeg2000_2)) { ImageData image = new Jpeg2000ImageData(bytes); Jpeg2000ImageHelper.ProcessImage(image); return(image); } else { if (ImageTypeIs(imageType, png)) { ImageData image = new PngImageData(bytes); PngImageHelper.ProcessImage(image); return(image); } else { if (ImageTypeIs(imageType, bmp)) { ImageData image = new BmpImageData(bytes, false, 0); BmpImageHelper.ProcessImage(image); return(image); } else { if (ImageTypeIs(imageType, tiff_1) || ImageTypeIs(imageType, tiff_2)) { ImageData image = new TiffImageData(bytes, recoverImage, 1, false); TiffImageHelper.ProcessImage(image); return(image); } else { if (ImageTypeIs(imageType, jbig2)) { ImageData image = new Jbig2ImageData(bytes, 1); Jbig2ImageHelper.ProcessImage(image); return(image); } } } } } } } throw new iText.IO.IOException(iText.IO.IOException.ImageFormatCannotBeRecognized); }