commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "VVD (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SANSELAN-64) Sanselat 0.97 can't read TIFF file without tag "Samples Per Pixel"
Date Thu, 01 Mar 2012 17:57:57 GMT
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


{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

        

Mime
View raw message