commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Damjan Jovanovic (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SANSELAN-64) Sanselat 0.97 can't read TIFF file without tag "Samples Per Pixel"
Date Thu, 01 Mar 2012 18:41:59 GMT

    [ https://issues.apache.org/jira/browse/SANSELAN-64?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220229#comment-13220229
] 

Damjan Jovanovic commented on SANSELAN-64:
------------------------------------------

SamplesPerPixel is mandatory for color images, but optional for black and white, grayscale,
and palleted. I fixed that particular problem a few months ago in SVN HEAD.

Compression 4 is also working in SVN HEAD, but not well documented, and only works with perfect
images. Many CCITT Group 4 compressed images are corrupt in just about every possible way,
and real-world TIFF parsers deal with that. It's something I hope to improve before 1.0 is
released.

You can try the unreleased version in SVN HEAD, or wait a few weeks for the 1.0 release.

                
> 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