Changeset 7155


Ignore:
Timestamp:
11/04/10 17:50:50 (9 years ago)
Author:
melissa
Message:

Fix for overwriting TIFF planes.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/out/TiffWriter.java

    r7149 r7155  
    3737import loci.formats.tiff.IFD; 
    3838import loci.formats.tiff.TiffCompression; 
     39import loci.formats.tiff.TiffParser; 
    3940import loci.formats.tiff.TiffSaver; 
    4041 
     
    233234  { 
    234235    IFD ifd = new IFD(); 
     236    TiffParser parser = new TiffParser(currentId); 
     237    long[] ifdOffsets = parser.getIFDOffsets(); 
     238    if (no < ifdOffsets.length) { 
     239      ifd = parser.getIFD(ifdOffsets[no]); 
     240    } 
     241 
    235242    if (compression == null) compression = ""; 
    236243    TiffCompression compressType = TiffCompression.UNCOMPRESSED; 
     
    247254      compressType = TiffCompression.JPEG; 
    248255    } 
    249     ifd.put(new Integer(IFD.COMPRESSION), compressType.getCode()); 
     256    if (ifd.getCompression() == null) { 
     257      ifd.put(new Integer(IFD.COMPRESSION), compressType.getCode()); 
     258    } 
    250259    saveBytes(no, buf, ifd, x, y, w, h); 
    251260  } 
  • trunk/components/bio-formats/src/loci/formats/out/TiffWriter.java

    r7149 r7155  
    3737import loci.formats.tiff.IFD; 
    3838import loci.formats.tiff.TiffCompression; 
     39import loci.formats.tiff.TiffParser; 
    3940import loci.formats.tiff.TiffSaver; 
    4041 
     
    233234  { 
    234235    IFD ifd = new IFD(); 
     236    TiffParser parser = new TiffParser(currentId); 
     237    long[] ifdOffsets = parser.getIFDOffsets(); 
     238    if (no < ifdOffsets.length) { 
     239      ifd = parser.getIFD(ifdOffsets[no]); 
     240    } 
     241 
    235242    if (compression == null) compression = ""; 
    236243    TiffCompression compressType = TiffCompression.UNCOMPRESSED; 
     
    247254      compressType = TiffCompression.JPEG; 
    248255    } 
    249     ifd.put(new Integer(IFD.COMPRESSION), compressType.getCode()); 
     256    if (ifd.getCompression() == null) { 
     257      ifd.put(new Integer(IFD.COMPRESSION), compressType.getCode()); 
     258    } 
    250259    saveBytes(no, buf, ifd, x, y, w, h); 
    251260  } 
Note: See TracChangeset for help on using the changeset viewer.