Uploaded image for project: 'XMLGraphicsCommons'
  1. XMLGraphicsCommons
  2. XGC-101

When using #page= indicator on multipage tiff image only first page is displayed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.1
    • None
    • image codecs

    Description

      In the org.apache.xmlgraphics.image.loader.impl.PreloaderTIFF class createImageInfo function the '#page=' construction is handled correctly:

      int pageIndex = ImageUtil.needPageIndexFromURI(uri);
      
                  SeekableStream seekable = new SeekableStreamAdapter(in);
                  TIFFDirectory dir;
                  try {
                      dir = new TIFFDirectory(seekable, pageIndex);
                  } catch (IllegalArgumentException iae) {
                      String errorMessage = MessageFormat.format(
                              "Subimage {0} does not exist.", new Object[] {pageIndex});
                      throw new SubImageNotFoundException(errorMessage);
                  }
      

      In the org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawCCITTFax class loadImage function the first page is always loaded:

      SeekableStream seekable = new SeekableStreamAdapter(in);
                  dir = new TIFFDirectory(seekable, 0);
                  TIFFField fld;
      

      if the lines above are changed into:

      SeekableStream seekable = new SeekableStreamAdapter(in);
                  int pageIndex = ImageUtil.needPageIndexFromURI(info.getOriginalURI());
                  try {
                      dir = new TIFFDirectory(seekable, pageIndex);
                  } catch (IllegalArgumentException iae) {
                      String errorMessage = MessageFormat.format(
                              "Subimage {0} does not exist.", new Object[] {pageIndex});
                      throw new SubImageNotFoundException(errorMessage);
                  }
                  TIFFField fld;
      

      it works as expected.

      ImageLoaderInternalTIFF needs a similar fix...

      Attachments

        Activity

          People

            Unassigned Unassigned
            Peter van der Velde Peter van der Velde
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: