/// <summary>Returns <c>List</c> of gif image frames</summary> /// <param name="url">url of gif image</param> /// <returns>all frames of gif image</returns> public static IList <ImageData> CreateGifFrames(Uri url) { ValidateImageType(url, ImageType.GIF); GifImageData image = new GifImageData(url); GifImageHelper.ProcessImage(image); return(image.GetFrames()); }
/// <summary>Returns <c>List</c> of gif image frames</summary> /// <param name="bytes">byte array of gif image</param> /// <returns>all frames of gif image</returns> public static IList <ImageData> CreateGifFrames(byte[] bytes) { ValidateImageType(bytes, ImageType.GIF); GifImageData image = new GifImageData(bytes); GifImageHelper.ProcessImage(image); return(image.GetFrames()); }
/// <summary>Return a GifImage object.</summary> /// <remarks>Return a GifImage object. This object cannot be added to a document</remarks> /// <param name="bytes">array containing the raw image data</param> /// <returns>GifImageData instance.</returns> public static GifImageData CreateGif(byte[] bytes) { ValidateImageType(bytes, ImageType.GIF); GifImageData image = new GifImageData(bytes); GifImageHelper.ProcessImage(image); return(image); }
/// <summary>Returns <CODE>List</CODE> of gif image frames</summary> /// <param name="url">url of gif image</param> /// <returns>all frames of gif image</returns> public static IList <ImageData> CreateGifFrames(Uri url) { byte[] imageType = ReadImageType(url); if (ImageTypeIs(imageType, gif)) { GifImageData image = new GifImageData(url); GifImageHelper.ProcessImage(image); return(image.GetFrames()); } throw new ArgumentException("GIF image expected."); }
/// <summary>Returns a specified frame of the gif image</summary> /// <param name="bytes">byte array of gif image</param> /// <param name="frame">number of frame to be returned</param> /// <returns>GifImageData instance.</returns> public static ImageData CreateGifFrame(byte[] bytes, int frame) { byte[] imageType = ReadImageType(bytes); if (ImageTypeIs(imageType, gif)) { GifImageData image = new GifImageData(bytes); GifImageHelper.ProcessImage(image, frame - 1); return(image.GetFrames()[frame - 1]); } throw new ArgumentException("GIF image expected."); }
/// <summary>Return a GifImage object.</summary> /// <remarks>Return a GifImage object. This object cannot be added to a document</remarks> /// <param name="bytes">array containing the raw image data</param> /// <returns>GifImageData instance.</returns> public static GifImageData CreateGif(byte[] bytes) { byte[] imageType = ReadImageType(bytes); if (ImageTypeIs(imageType, gif)) { GifImageData image = new GifImageData(bytes); GifImageHelper.ProcessImage(image); return(image); } throw new ArgumentException("GIF image expected."); }
private static IList <ImageData> ProcessGifImageAndExtractFrames(int[] frameNumbers, GifImageData image) { JavaUtil.Sort(frameNumbers); GifImageHelper.ProcessImage(image, frameNumbers[frameNumbers.Length - 1] - 1); IList <ImageData> frames = new List <ImageData>(); foreach (int frame in frameNumbers) { frames.Add(image.GetFrames()[frame - 1]); } return(frames); }
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); } } }
/// <summary>Returns <CODE>List</CODE> of gif image frames</summary> /// <param name="url">url of gif image</param> /// <param name="frameNumbers">array of frame numbers of gif image</param> /// <returns>All frames of gif image.</returns> public static IList <ImageData> CreateGifFrames(Uri url, int[] frameNumbers) { byte[] imageType = ReadImageType(url); if (ImageTypeIs(imageType, gif)) { GifImageData image = new GifImageData(url); iText.IO.Util.JavaUtil.Sort(frameNumbers); GifImageHelper.ProcessImage(image, frameNumbers[frameNumbers.Length - 1] - 1); IList <ImageData> frames = new List <ImageData>(); foreach (int frame in frameNumbers) { frames.Add(image.GetFrames()[frame - 1]); } return(frames); } throw new ArgumentException("GIF image expected."); }
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); }