You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Lucas (Jira)" <ji...@apache.org> on 2020/10/21 14:26:00 UTC

[jira] [Created] (IMAGING-271) Proposed new class for memory-efficient TIFF image writing

Gary Lucas created IMAGING-271:
----------------------------------

             Summary: Proposed new class for memory-efficient TIFF image writing
                 Key: IMAGING-271
                 URL: https://issues.apache.org/jira/browse/IMAGING-271
             Project: Commons Imaging
          Issue Type: New Feature
          Components: Format: TIFF
    Affects Versions: 1.0-alpha3
            Reporter: Gary Lucas
         Attachments: TiffImageWriterAppender.java

I am proposing to implement a new class for writing TIFF images in a memory-efficient manner. This class will permit the creation of large-scale TIFF images without undue requirements for memory.  It will also support the creation of TIFF files containing multiple images (in TIFF terminology, "directories").

I am posting this Jira item to request suggestions for the design of the class as well as to identify requirements from potential users.

The current TIFF image-writer classes operate on an entire BufferedImage and actually make a copy of the image data before writing it to an output stream.  They do not permit the creation of output images "a piece at a time".  So for very large images, they can require considerable use of memory.

The proposed approach would allow an application to "append" data to a TIFF file making multiple calls to output methods. The TIFF specification calls for files to be organized into "sections" (strips or tiles). This class will permit an application to write data to the TIFF file a section at a time.

 I have attached a stub Java class to provide an example of the proposed design. This example is intended to promote discussion and help identify relevant features for the initial implementation.

Some guiding principles and concepts for design:
 # Simplicity.  The greatest strength of the TIFF file format, its versatility, is also its greatest weakness. The need to support such a large variety of data formats and operations leads to a complicated API that is sometimes difficult to use.  The proposed design limits some of the output functionality in order to maintain a simpler API. 
 # Essential features only.  Currently, I have limited resources to devote to this implementation. My intention is to implement only those functions that make the class viable. So the challenge here will be determining what those features are. Comments are welcome. On the other hand, I am striving for a design that will facilitate future development to add other features as they are identified by the user community. 
 # Operates on files, and only files.  The current Commons Imaging API supports output to various kinds of Java OutputStreams, including memory and socket streams. This class is purposely designed to write to random-access files. This consideration [^TiffImageWriterAppender.java]is particularly important to support cases where the ultimate size of the output content cannot be determined a priori.

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)