3

I'm reading a multiple tiff image with a resolution of 1728*2164 using the jai-imageio library 1.3.1.

code is :

ImageInputStream is = ImageIO.createImageInputStream(new File(path));
Iterator<ImageReader> iterator = ImageIO.getImageReaders(is);
TIFFImageReader reader = (TIFFImageReader) iterator.next();
reader.setInput(is);

When i look at the matadata using:

IIOMetadata metadata = reader.getImageMetadata(0);

i see the height of the images is only 1082px

How can i read the full resolution tiff image or alternatively set a different resolution to be read?

this is all the metadata on my file

 <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>
Assi
  • 43
  • 3
  • 2
    From the TIFF tags you can see that the image's true resolution is 1728x1082. It's a FAX with a resolution of 200x100, so the pixels need to be stretched vertically by 2x to look correct when displayed. – BitBank Feb 24 '17 at 10:34
  • Hi BitBank , thanks for clarifying that. – Assi Feb 27 '17 at 08:54

0 Answers0