You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Damjan Jovanovic (Resolved) (JIRA)" <ji...@apache.org> on 2012/03/01 19:43:58 UTC
[jira] [Resolved] (SANSELAN-64) Sanselat 0.97 can't read TIFF file
without tag "Samples Per Pixel"
[ https://issues.apache.org/jira/browse/SANSELAN-64?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Damjan Jovanovic resolved SANSELAN-64.
--------------------------------------
Resolution: Fixed
Fix Version/s: 1.0
All issues, including the one described in the bug title, are already fixed in SVN, so resolving FIXED.
> Sanselat 0.97 can't read TIFF file without tag "Samples Per Pixel"
> ------------------------------------------------------------------
>
> Key: SANSELAN-64
> URL: https://issues.apache.org/jira/browse/SANSELAN-64
> Project: Commons Sanselan
> Issue Type: Bug
> Components: Format: TIFF
> Affects Versions: 0.97
> Environment: Any
> Reporter: VVD
> Fix For: 1.0
>
>
> {code:title=Test.java|borderStyle=solid}
> package test;
> import ...;
> public class Test {
> public static void main (String[] args) {
> File fin = new File("/file.tif");
> File fout = new File("/file.png");
> try {
> Map params = new Hashtable();
> BufferedImage image = Sanselan.getBufferedImage(fin);
> Sanselan.writeImage(image, fout, ImageFormat.IMAGE_FORMAT_PNG, new Hashtable());
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> {code}
> org.apache.sanselan.ImageReadException: Missing expected field: 277 (0x115: Samples Per Pixel):
> at org.apache.sanselan.formats.tiff.TiffDirectory.findField(TiffDirectory.java:186)
> at org.apache.sanselan.formats.tiff.TiffImageParser.getBufferedImage(TiffImageParser.java:463)
> at org.apache.sanselan.formats.tiff.TiffDirectory.getTiffImage(TiffDirectory.java:163)
> at org.apache.sanselan.formats.tiff.TiffImageParser.getBufferedImage(TiffImageParser.java:441)
> at org.apache.sanselan.Sanselan.getBufferedImage(Sanselan.java:1264)
> at org.apache.sanselan.Sanselan.getBufferedImage(Sanselan.java:1231)
> at test.Test.main(Test.java:24)
> 24 is line: "BufferedImage image = Sanselan.getBufferedImage(fin);"
> I look at sources and see that TIFF_TAG_SAMPLES_PER_PIXEL is mandatory tag:
> "int samplesPerPixel = directory.findField(TIFF_TAG_SAMPLES_PER_PIXEL, *true*).getIntValue();"
> Why?
> ImageMagick simple show warning and convert it correctly:
> Unknown field with tag 32309 (0x7e35) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/761.
> Unknown field with tag 32950 (0x80b6) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/761.
> KDE applications (gwenview, okular, kolourpaint) show warning and open too:
> TIFFReadDirectory: Warning, Unknown field with tag 32309 (0x7e35) encountered.
> TIFFReadDirectory: Warning, Unknown field with tag 32950 (0x80b6) encountered.
> Do I need to check not released versions (from sources)?
> Also TIFF compression 4 isn't supported, but I saw Issue that Sanselat 1.0 is support it, but 1.0 isn't released yet.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira