我正在使用jai-imageio库1.3.1读取分辨率为1728 * 2164的多个tiff图像。
代码是:
ImageInputStream is = ImageIO.createImageInputStream(new File(path));
Iterator<ImageReader> iterator = ImageIO.getImageReaders(is);
TIFFImageReader reader = (TIFFImageReader) iterator.next();
reader.setInput(is);
当我使用以下方式查看matadata时:
IIOMetadata metadata = reader.getImageMetadata(0);
我看到图像的高度仅为1082px
如何读取全分辨率tiff图像或者设置不同的分辨率?
这是我文件中的所有元数据
<TIFFField number="256" name="ImageWidth">
<TIFFLongs>
<TIFFLong value="1728"/>
</TIFFLongs>
</TIFFField>
<TIFFField number="257" name="ImageLength">
<TIFFLongs>
<TIFFLong value="1082"/>
</TIFFLongs>
</TIFFField>
<TIFFField number="258" name="BitsPerSample">
<TIFFShorts>
<TIFFShort value="1"/>
</TIFFShorts>
</TIFFField>
<TIFFField number="259" name="Compression">
<TIFFShorts>
<TIFFShort value="3" description="CCITT T.4"/>
</TIFFShorts>
</TIFFField>
<TIFFField number="262" name="PhotometricInterpretation">
<TIFFShorts>
<TIFFShort value="0" description="WhiteIsZero"/>
</TIFFShorts>
</TIFFField>
<TIFFField number="266" name="FillOrder">
<TIFFShorts>
<TIFFShort value="1" description="LeftToRight"/>
</TIFFShorts>
</TIFFField>
<TIFFField number="273" name="StripOffsets">
<TIFFLongs>
<TIFFLong value="210"/>
</TIFFLongs>
</TIFFField>
<TIFFField number="277" name="SamplesPerPixel">
<TIFFShorts>
<TIFFShort value="1"/>
</TIFFShorts>
</TIFFField>
<TIFFField number="278" name="RowsPerStrip">
<TIFFLongs>
<TIFFLong value="1082"/>
</TIFFLongs>
</TIFFField>
<TIFFField number="279" name="StripByteCounts">
<TIFFLongs>
<TIFFLong value="23214"/>
</TIFFLongs>
</TIFFField>
<TIFFField number="282" name="XResolution">
<TIFFRationals>
<TIFFRational value="200/1"/>
</TIFFRationals>
</TIFFField>
<TIFFField number="283" name="YResolution">
<TIFFRationals>
<TIFFRational value="100/1"/>
</TIFFRationals>
</TIFFField>
<TIFFField number="284" name="PlanarConfiguration">
<TIFFShorts>
<TIFFShort value="1" description="Chunky"/>
</TIFFShorts>
</TIFFField>
<TIFFField number="292" name="T4Options">
<TIFFLongs>
<TIFFLong value="0" description="Default 1DCoding"/>
</TIFFLongs>
</TIFFField>
<TIFFField number="296" name="ResolutionUnit">
<TIFFShorts>
<TIFFShort value="2" description="Inch"/>
</TIFFShorts>
</TIFFField>
</TIFFIFD>
</com_sun_media_imageio_plugins_tiff_image_1.0>
Format name: javax_imageio_1.0
<javax_imageio_1.0>
<Chroma>
<ColorSpaceType name="GRAY"/>
<BlackIsZero value="FALSE"/>
<NumChannels value="1"/>
</Chroma>
<Compression>
<CompressionTypeName value="CCITT T.4"/>
<Lossless value="TRUE"/>
<NumProgressiveScans value="1"/>
</Compression>
<Data>
<PlanarConfiguration value="PixelInterleaved"/>
<SampleFormat value="UnsignedIntegral"/>
<BitsPerSample value="1"/>
<SampleMSB value="7"/>
</Data>
<Dimension>
<PixelAspectRatio value="0.5"/>
<HorizontalPixelSize value="0.127"/>
<VerticalPixelSize value="0.254"/>
</Dimension>
<Document>
<FormatVersion value="6.0"/>
</Document>
<Transparency>
<Alpha value="none"/>
</Transparency>
</javax_imageio_1.0>