Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-127

API to get a single image should allow choosing which image

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • Patch Needed
    • None
    • None

    Description

      getBufferedImage() only returns the first image. There should be a way to retrieve any image by index (and by extension, an API to get the image count.)

      getBufferedImages() cannot be used for large multi-page TIFF files, because creating that many BufferedImage objects causes an OutOfMemoryError.

      (For that matter, a method to get a scaled down copy would be useful as well, as some formats can optimise that not to retrieve all the data, but also it means you can reduce the memory usage for absolutely massive images.)

      Attachments

        1. 2472527552.gif
          3.98 MB
          Luke Quinane
        2. june 1 part I.tif
          2.92 MB
          Trejkaz
        3. Wakarusa2015-0001.mpo
          347 kB
          Luke Quinane

        Activity

          gwlucas Gary Lucas added a comment - - edited

          I've thought about working on this problem a couple of times. One of the reasons I've never made much progress on it is that I lack good sample data. Would you be in a position to supply some multi-page TIFFs? I'd prefer samples containing relatively small images. It will make development easier to work with smaller files in the initial phase.

          Alternately, if you know of a source of sample images in the public domain on the web, please let me know.

          gwlucas Gary Lucas added a comment - - edited I've thought about working on this problem a couple of times. One of the reasons I've never made much progress on it is that I lack good sample data. Would you be in a position to supply some multi-page TIFFs? I'd prefer samples containing relatively small images. It will make development easier to work with smaller files in the initial phase. Alternately, if you know of a source of sample images in the public domain on the web, please let me know.
          trejkaz Trejkaz added a comment -

          Sorry for the delay. I have this stuff on my home email but all the good source data was at work...

          Here's a file I can redistribute. It's particularly interesting because every page has a slightly different size. Since it seems like it came from a scanner, there might be other interesting properties...

          trejkaz Trejkaz added a comment - Sorry for the delay. I have this stuff on my home email but all the good source data was at work... Here's a file I can redistribute. It's particularly interesting because every page has a slightly different size. Since it seems like it came from a scanner, there might be other interesting properties...
          luke-nuix Luke Quinane added a comment -

          This will also apply to the frames of animated GIFs. Sample attached.

          luke-nuix Luke Quinane added a comment - This will also apply to the frames of animated GIFs. Sample attached.
          luke-nuix Luke Quinane added a comment -

          Multi-picture JPEGs are also possible. Sample attached (Wakarusa2015-0001.mpo).

          luke-nuix Luke Quinane added a comment - Multi-picture JPEGs are also possible. Sample attached (Wakarusa2015-0001.mpo).
          lielfr Liel Fridman added a comment -

          Hi,

          Is this issue still relevant? If it is, I'd like to work on it.

          Regarding the function definition, how should it look like? I thought about something like getBufferedImageAtIndex or something like this, which will also allow to specify the index. And maybe getBufferedImageCount to get the number of images. However, these are just my suggestions.

           

          Thanks

           

          lielfr Liel Fridman added a comment - Hi, Is this issue still relevant? If it is, I'd like to work on it. Regarding the function definition, how should it look like? I thought about something like getBufferedImageAtIndex or something like this, which will also allow to specify the index. And maybe getBufferedImageCount to get the number of images. However, these are just my suggestions.   Thanks  
          gwlucas Gary Lucas added a comment -

          I'm don't know what the level of interest is for this issue.   But I do know of an example application in the "test" hierarchy that shows one way to extract images and metadata. It uses low-level calls and is a bit specialized for general application work.  It might help get you started on your own implementation.

          Directory:

            commons-imaging-master\src\test\java\org\apache\commons\imaging\examples\tiff

          File

          ReadTagsAndImages.java

           

          gwlucas Gary Lucas added a comment - I'm don't know what the level of interest is for this issue.   But I do know of an example application in the "test" hierarchy that shows one way to extract images and metadata. It uses low-level calls and is a bit specialized for general application work.  It might help get you started on your own implementation. Directory:   commons-imaging-master\src\test\java\org\apache\commons\imaging\examples\tiff File ReadTagsAndImages.java  

          People

            Unassigned Unassigned
            trejkaz Trejkaz
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: