Ejemplo n.º 1
0
        internal PlainImage ReadPlainImage()
        {
            awt.Image img = ReadImage(_currentFrame);
            if (img == null)
            {
                return(null);
            }

            // its possible to fail to load thumbnails and metadata, but image is ok.
            awt.Image [] th = null;
#if THUMBNAIL_SUPPORTED
            try {
                th = ReadThumbnails(_currentFrame);
            }
            catch (Exception) {}
#endif

            XmlDocument md = null;
            imageio.metadata.IIOMetadata nativeMd = null;
            try {
                nativeMd = ReadImageMetadata(_currentFrame);
                md       = ConvertImageMetadata(nativeMd);
            }
            catch (Exception) {}

            float [] resolution = GetResolution(md);

            PlainImage pi = new PlainImage(img, th, ImageFormat, resolution[0], resolution[1], FormatFrameDimesion);
            pi.NativeMetadata = nativeMd;
            return(pi);
        }
Ejemplo n.º 2
0
		private XmlDocument ConvertImageMetadata(imageio.metadata.IIOMetadata metaData) {
			string [] formatNames = metaData.getMetadataFormatNames();
			dom.Element rootNode = (dom.Element) metaData.getAsTree(formatNames[0]);

			XmlDocument _metadataDocument = new XmlDocument();
			XmlConvert(rootNode, _metadataDocument);

			return _metadataDocument;
		}
Ejemplo n.º 3
0
		private imageio.metadata.IIOMetadata ReadImageMetadata(int frameIndex) {
			if (NativeStream == null)
				throw new Exception("Input stream not specified");

			try {
				imageio.metadata.IIOMetadata md = NativeReader.getImageMetadata( frameIndex );
				return md;
			}
			catch (java.io.IOException ex) {
				throw new System.IO.IOException(ex.Message, ex);
			}
		}