mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-20 00:00:03 -04:00
Compare commits
12 Commits
master
...
3.2-bugfix
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c1d72fd46 | |||
| 94d480ec64 | |||
| 9654a924b7 | |||
| 6d9acaee2d | |||
| fdad13e28f | |||
| 6ce58dd682 | |||
| f21bc2089a | |||
| 65f3bbbccd | |||
| 8346c4148e | |||
| 7c0b4fd91a | |||
| b818454a3f | |||
| 9c8b4ad0d4 |
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Master branch build status: [](https://travis-ci.org/haraldk/TwelveMonkeys)
|
Master branch build status: [](https://travis-ci.org/haraldk/TwelveMonkeys)
|
||||||
|
|
||||||
TwelveMonkeys ImageIO [3.1.2](http://search.maven.org/#search%7Cga%7C1%7Cg%3Acom.twelvemonkeys*%20AND%20v%3A%223.1.2%22) is released (Aug. 14th, 2015).
|
TwelveMonkeys ImageIO [3.2](http://search.maven.org/#search%7Cga%7C1%7Cg%3Acom.twelvemonkeys*%20AND%20v%3A%223.2%22) is released (Nov. 1st, 2015).
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ Alternatively, if you have or know of a JPEG-2000 implementation in Java with a
|
|||||||
* CMYK, 4-5 channels, 8, 16 and 32 bit
|
* CMYK, 4-5 channels, 8, 16 and 32 bit
|
||||||
* Read support for the following compression types:
|
* Read support for the following compression types:
|
||||||
* Uncompressed
|
* Uncompressed
|
||||||
* RLE (PackBits)
|
* RLE (PackBits)<
|
||||||
* Layer support
|
* Layer support
|
||||||
* Image layers only, in all of the above types
|
* Image layers only, in all of the above types
|
||||||
* Thumbnail support
|
* Thumbnail support
|
||||||
@@ -121,7 +121,7 @@ Alternatively, if you have or know of a JPEG-2000 implementation in Java with a
|
|||||||
* Alpha channel (ExtraSamples type 1/Associated Alpha and type 2/Unassociated Alpha)
|
* Alpha channel (ExtraSamples type 1/Associated Alpha and type 2/Unassociated Alpha)
|
||||||
* CMYK data (PhotometricInterpretation type 5/Separated)
|
* CMYK data (PhotometricInterpretation type 5/Separated)
|
||||||
* YCbCr data (PhotometricInterpretation type 6/YCbCr) for JPEG
|
* YCbCr data (PhotometricInterpretation type 6/YCbCr) for JPEG
|
||||||
* CIELab data (PhotometricInterpretation type 9, 10 and 11)
|
* CIELab data in TIFF, ITU and ICC variants (PhotometricInterpretation type 9, 10 and 11)
|
||||||
* Planar data (PlanarConfiguration type 2/Planar)
|
* Planar data (PlanarConfiguration type 2/Planar)
|
||||||
* ICC profiles (ICCProfile)
|
* ICC profiles (ICCProfile)
|
||||||
* BitsPerSample values up to 16 for most PhotometricInterpretations
|
* BitsPerSample values up to 16 for most PhotometricInterpretations
|
||||||
@@ -135,6 +135,15 @@ Alternatively, if you have or know of a JPEG-2000 implementation in Java with a
|
|||||||
|
|
||||||
Legacy formats
|
Legacy formats
|
||||||
|
|
||||||
|
#### HDR - Radiance High Dynamic Range RGBE Format
|
||||||
|
|
||||||
|
* Read support for the most common RGBE (.hdr) format
|
||||||
|
* Samples are converted to 32 bit floating point (`float`) and normalized using a global tone mapper by default.
|
||||||
|
* Support for custom global tone mappers
|
||||||
|
* Alternatively, use a "null-tone mapper", for unnormalized data (allows local tone mapping)
|
||||||
|
* Unconverted RGBE samples accessible using `readRaster`
|
||||||
|
* Standard metadata support
|
||||||
|
|
||||||
#### IFF - Commodore Amiga/Electronic Arts Interchange File Format
|
#### IFF - Commodore Amiga/Electronic Arts Interchange File Format
|
||||||
|
|
||||||
* Legacy format, allows reading popular image format from the Commodore Amiga computer.
|
* Legacy format, allows reading popular image format from the Commodore Amiga computer.
|
||||||
@@ -229,6 +238,9 @@ Other formats, using 3rd party libraries
|
|||||||
|
|
||||||
* Limited read-only support using Batik
|
* Limited read-only support using Batik
|
||||||
|
|
||||||
|
**Important note on using Batik:** *Please read [The Apache™ XML Graphics Project - Security](http://xmlgraphics.apache.org/security.html), and make sure you use
|
||||||
|
either version 1.6.1, 1.7.1 or 1.8+.*
|
||||||
|
|
||||||
|
|
||||||
## Basic usage
|
## Basic usage
|
||||||
|
|
||||||
@@ -467,12 +479,12 @@ To depend on the JPEG and TIFF plugin using Maven, add the following to your POM
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio-jpeg</artifactId>
|
<artifactId>imageio-jpeg</artifactId>
|
||||||
<version>3.1.2</version> <!-- Alternatively, build your own version -->
|
<version>3.2</version> <!-- Alternatively, build your own version -->
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio-tiff</artifactId>
|
<artifactId>imageio-tiff</artifactId>
|
||||||
<version>3.1.2</version> <!-- Alternatively, build your own version -->
|
<version>3.2</version> <!-- Alternatively, build your own version -->
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -480,51 +492,52 @@ To depend on the JPEG and TIFF plugin using Maven, add the following to your POM
|
|||||||
|
|
||||||
To depend on the JPEG and TIFF plugin in your IDE or program, add all of the following JARs to your class path:
|
To depend on the JPEG and TIFF plugin in your IDE or program, add all of the following JARs to your class path:
|
||||||
|
|
||||||
twelvemonkeys-common-lang-3.1.2.jar
|
twelvemonkeys-common-lang-3.2.jar
|
||||||
twelvemonkeys-common-io-3.1.2.jar
|
twelvemonkeys-common-io-3.2.jar
|
||||||
twelvemonkeys-common-image-3.1.2.jar
|
twelvemonkeys-common-image-3.2.jar
|
||||||
twelvemonkeys-imageio-core-3.1.2.jar
|
twelvemonkeys-imageio-core-3.2.jar
|
||||||
twelvemonkeys-imageio-metadata-3.1.2.jar
|
twelvemonkeys-imageio-metadata-3.2.jar
|
||||||
twelvemonkeys-imageio-jpeg-3.1.2.jar
|
twelvemonkeys-imageio-jpeg-3.2.jar
|
||||||
twelvemonkeys-imageio-tiff-3.1.2.jar
|
twelvemonkeys-imageio-tiff-3.2.jar
|
||||||
|
|
||||||
### Links to prebuilt binaries
|
### Links to prebuilt binaries
|
||||||
|
|
||||||
##### Latest version (3.1.x)
|
##### Latest version (3.2.x)
|
||||||
|
|
||||||
Requires Java 7 or later.
|
Requires Java 7 or later.
|
||||||
|
|
||||||
Common dependencies
|
Common dependencies
|
||||||
* [common-lang-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/common/common-lang/3.1.2/common-lang-3.1.2.jar)
|
* [common-lang-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/common/common-lang/3.2/common-lang-3.2.jar)
|
||||||
* [common-io-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/common/common-io/3.1.2/common-io-3.1.2.jar)
|
* [common-io-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/common/common-io/3.2/common-io-3.2.jar)
|
||||||
* [common-image-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/common/common-image/3.1.2/common-image-3.1.2.jar)
|
* [common-image-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/common/common-image/3.2/common-image-3.2.jar)
|
||||||
|
|
||||||
ImageIO dependencies
|
ImageIO dependencies
|
||||||
* [imageio-core-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-core/3.1.2/imageio-core-3.1.2.jar)
|
* [imageio-core-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-core/3.2/imageio-core-3.2.jar)
|
||||||
* [imageio-metadata-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-metadata/3.1.2/imageio-metadata-3.1.2.jar)
|
* [imageio-metadata-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-metadata/3.2/imageio-metadata-3.2.jar)
|
||||||
|
|
||||||
ImageIO plugins
|
ImageIO plugins
|
||||||
* [imageio-bmp-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-bmp/3.1.2/imageio-bmp-3.1.2.jar)
|
* [imageio-bmp-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-bmp/3.2/imageio-bmp-3.2.jar)
|
||||||
* [imageio-jpeg-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-jpeg/3.1.2/imageio-jpeg-3.1.2.jar)
|
* [imageio-jpeg-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-jpeg/3.2/imageio-jpeg-3.2.jar)
|
||||||
* [imageio-tiff-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-tiff/3.1.2/imageio-tiff-3.1.2.jar)
|
* [imageio-tiff-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-tiff/3.2/imageio-tiff-3.2.jar)
|
||||||
* [imageio-pnm-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-pnm/3.1.2/imageio-pnm-3.1.2.jar)
|
* [imageio-pnm-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-pnm/3.2/imageio-pnm-3.2.jar)
|
||||||
* [imageio-psd-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-psd/3.1.2/imageio-psd-3.1.2.jar)
|
* [imageio-psd-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-psd/3.2/imageio-psd-3.2.jar)
|
||||||
* [imageio-iff-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-iff/3.1.2/imageio-iff-3.1.2.jar)
|
* [imageio-hdr-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-hdr/3.2/imageio-hdr-3.2.jar)
|
||||||
* [imageio-pcx-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-pcx/3.1.2/imageio-pcx-3.1.2.jar)
|
* [imageio-iff-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-iff/3.2/imageio-iff-3.2.jar)
|
||||||
* [imageio-pict-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-pict/3.1.2/imageio-pict-3.1.2.jar)
|
* [imageio-pcx-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-pcx/3.2/imageio-pcx-3.2.jar)
|
||||||
* [imageio-sgi-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-sgi/3.1.2/imageio-sgi-3.1.2.jar)
|
* [imageio-pict-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-pict/3.2/imageio-pict-3.2.jar)
|
||||||
* [imageio-tga-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-tga/3.1.2/imageio-tga-3.1.2.jar)
|
* [imageio-sgi-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-sgi/3.2/imageio-sgi-3.2.jar)
|
||||||
* [imageio-icns-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-icns/3.1.2/imageio-icns-3.1.2.jar)
|
* [imageio-tga-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-tga/3.2/imageio-tga-3.2.jar)
|
||||||
* [imageio-thumbsdb-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-thumbsdb/3.1.2/imageio-thumbsdb-3.1.2.jar)
|
* [imageio-icns-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-icns/3.2/imageio-icns-3.2.jar)
|
||||||
|
* [imageio-thumbsdb-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-thumbsdb/3.2/imageio-thumbsdb-3.2.jar)
|
||||||
|
|
||||||
ImageIO plugins requiring 3rd party libs
|
ImageIO plugins requiring 3rd party libs
|
||||||
* [imageio-batik-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-batik/3.1.2/imageio-batik-3.1.2.jar)
|
* [imageio-batik-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-batik/3.2/imageio-batik-3.2.jar)
|
||||||
|
|
||||||
Photoshop Path support for ImageIO
|
Photoshop Path support for ImageIO
|
||||||
* [imageio-clippath-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-clippath/3.1.2/imageio-clippath-3.1.2.jar)
|
* [imageio-clippath-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/imageio/imageio-clippath/3.2/imageio-clippath-3.2.jar)
|
||||||
|
|
||||||
Servlet support
|
Servlet support
|
||||||
* [servlet-3.1.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/servlet/servlet/3.1.2/servlet-3.1.2.jar)
|
* [servlet-3.2.jar](http://search.maven.org/remotecontent?filepath=com/twelvemonkeys/servlet/servlet/3.2/servlet-3.2.jar)
|
||||||
|
|
||||||
##### Old version (3.0.x)
|
##### Old version (3.0.x)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.twelvemonkeys.bom</groupId>
|
<groupId>com.twelvemonkeys.bom</groupId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common-image</artifactId>
|
<artifactId>common-image</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -1465,7 +1465,7 @@ public class ResampleOp implements BufferedImageOp/* TODO: RasterOp */ {
|
|||||||
|
|
||||||
for (int i = 0; i < dstHeight; i++) {
|
for (int i = 0; i < dstHeight; i++) {
|
||||||
//contribY[i].n = 0;
|
//contribY[i].n = 0;
|
||||||
contribY[i].p = new Contributor[(int) (width * 2.0 + 1)];
|
contribY[i].p = new Contributor[(int) (width * 2.0 + 1 + 0.5)];
|
||||||
|
|
||||||
double center = (double) i / yscale;
|
double center = (double) i / yscale;
|
||||||
int left = (int) Math.ceil(center - width);
|
int left = (int) Math.ceil(center - width);
|
||||||
@@ -1516,7 +1516,7 @@ public class ResampleOp implements BufferedImageOp/* TODO: RasterOp */ {
|
|||||||
else {
|
else {
|
||||||
for (int i = 0; i < dstHeight; ++i) {
|
for (int i = 0; i < dstHeight; ++i) {
|
||||||
//contribY[i].n = 0;
|
//contribY[i].n = 0;
|
||||||
contribY[i].p = new Contributor[(int) (fwidth * 2 + 1)];
|
contribY[i].p = new Contributor[(int) (fwidth * 2 + 1 + 0.5)];
|
||||||
|
|
||||||
double center = (double) i / yscale;
|
double center = (double) i / yscale;
|
||||||
double left = Math.ceil(center - fwidth);
|
double left = Math.ceil(center - fwidth);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class ResampleOpTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertResampleBufferedImageTypes(final int pFilterType) {
|
private void assertResampleBufferedImageTypes(final int pFilterType) {
|
||||||
List<String> exceptions = new ArrayList<String>();
|
List<String> exceptions = new ArrayList<>();
|
||||||
|
|
||||||
// Test all image types in BufferedImage
|
// Test all image types in BufferedImage
|
||||||
for (int type = BufferedImage.TYPE_INT_ARGB; type <= BufferedImage.TYPE_BYTE_INDEXED; type++) {
|
for (int type = BufferedImage.TYPE_INT_ARGB; type <= BufferedImage.TYPE_BYTE_INDEXED; type++) {
|
||||||
@@ -304,6 +304,18 @@ public class ResampleOpTestCase {
|
|||||||
assertResampleBufferedImageTypes(ResampleOp.FILTER_LANCZOS);
|
assertResampleBufferedImageTypes(ResampleOp.FILTER_LANCZOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/haraldk/TwelveMonkeys/issues/195
|
||||||
|
@Test
|
||||||
|
public void testAIOOBE() {
|
||||||
|
BufferedImage myImage = new BufferedImage(100, 354, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
|
for (int i = 19; i > 0; i--) {
|
||||||
|
ResampleOp resampler = new ResampleOp(100, i, ResampleOp.FILTER_LANCZOS);
|
||||||
|
BufferedImage resizedImage = resampler.filter(myImage, null);
|
||||||
|
assertNotNull(resizedImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Ignore("Not for general unit testing")
|
@Ignore("Not for general unit testing")
|
||||||
@Test
|
@Test
|
||||||
public void testTime() {
|
public void testTime() {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common-io</artifactId>
|
<artifactId>common-io</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common-lang</artifactId>
|
<artifactId>common-lang</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.twelvemonkeys.common</groupId>
|
<groupId>com.twelvemonkeys.common</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-batik</artifactId>
|
<artifactId>imageio-batik</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Batik Plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: Batik Plugin</name>
|
||||||
@@ -26,24 +26,40 @@
|
|||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Batik 1.6 contains a mysterious xml-apis:xml-apis:1.1.2 that doesn't exist, override with never version -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>batik</groupId>
|
<groupId>xml-apis</groupId>
|
||||||
<artifactId>batik-rasterizer-ext</artifactId>
|
<artifactId>xml-apis</artifactId>
|
||||||
<version>1.6-1</version>
|
<version>1.3.04</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Nothing works without Xerces. Not sure why neither 1.6 or 1.8 versions needed this... -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>xerces</groupId>
|
||||||
|
<artifactId>xercesImpl</artifactId>
|
||||||
|
<version>2.4.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>batik</groupId>
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
|
<artifactId>batik-rasterizer</artifactId>
|
||||||
|
<version>1.6.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
<artifactId>batik-svggen</artifactId>
|
<artifactId>batik-svggen</artifactId>
|
||||||
<version>1.6-1</version>
|
<version>1.6.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>batik</groupId>
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
<artifactId>batik-transcoder</artifactId>
|
<artifactId>batik-transcoder</artifactId>
|
||||||
<version>1.6-1</version>
|
<version>1.6.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
+59
-34
@@ -34,6 +34,7 @@ import com.twelvemonkeys.imageio.util.IIOUtil;
|
|||||||
import javax.imageio.ImageReader;
|
import javax.imageio.ImageReader;
|
||||||
import javax.imageio.spi.ServiceRegistry;
|
import javax.imageio.spi.ServiceRegistry;
|
||||||
import javax.imageio.stream.ImageInputStream;
|
import javax.imageio.stream.ImageInputStream;
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@@ -61,8 +62,7 @@ public final class SVGImageReaderSpi extends ImageReaderSpiBase {
|
|||||||
|
|
||||||
private static boolean canDecode(final ImageInputStream pInput) throws IOException {
|
private static boolean canDecode(final ImageInputStream pInput) throws IOException {
|
||||||
// NOTE: This test is quite quick as it does not involve any parsing,
|
// NOTE: This test is quite quick as it does not involve any parsing,
|
||||||
// however it requires the doctype to be "svg", which may not be correct
|
// however it may not recognize all kinds of SVG documents.
|
||||||
// in all cases...
|
|
||||||
try {
|
try {
|
||||||
pInput.mark();
|
pInput.mark();
|
||||||
|
|
||||||
@@ -74,51 +74,76 @@ public final class SVGImageReaderSpi extends ImageReaderSpiBase {
|
|||||||
// Skip over leading WS
|
// Skip over leading WS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((b == '<') && (pInput.read() == '?') && (pInput.read() == 'x') && (pInput.read() == 'm')
|
// If it's not a tag, this can't be valid XML
|
||||||
&& (pInput.read() == 'l'))) {
|
if (b != '<') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Okay, we have XML. But, is it really SVG?
|
// Algorithm for detecting SVG:
|
||||||
boolean docTypeFound = false;
|
// - Skip until begin tag '<' and read 4 bytes
|
||||||
while (!docTypeFound) {
|
// - if next is "?" skip until "?>" and start over
|
||||||
while (pInput.read() != '<') {
|
// - else if next is "!--" skip until "-->" and start over
|
||||||
// Skip over, until begin tag
|
// - else if next is "!DOCTYPE " skip any whitespace
|
||||||
}
|
// - compare next 3 bytes against "svg", return result
|
||||||
|
// - else
|
||||||
|
// - compare next 3 bytes against "svg", return result
|
||||||
|
|
||||||
if ((b = pInput.read()) != '!') {
|
byte[] buffer = new byte[4];
|
||||||
if (b == 's' && pInput.read() == 'v' && pInput.read() == 'g'
|
while (true) {
|
||||||
&& (Character.isWhitespace((char) (b = pInput.read())) || b == ':')) {
|
pInput.readFully(buffer);
|
||||||
|
|
||||||
|
if (buffer[0] == '?') {
|
||||||
|
// This is the XML declaration or a processing instruction
|
||||||
|
while (!(pInput.read() == '?' && pInput.read() == '>')) {
|
||||||
|
// Skip until end of XML declaration or processing instruction
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (buffer[0] == '!') {
|
||||||
|
if (buffer[1] == '-' && buffer[2] == '-') {
|
||||||
|
// This is a comment
|
||||||
|
while (!(pInput.read() == '-' && pInput.read() == '-' && pInput.read() == '>')) {
|
||||||
|
// Skip until end of comment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (buffer[1] == 'D' && buffer[2] == 'O' && buffer[3] == 'C'
|
||||||
|
&& pInput.read() == 'T' && pInput.read() == 'Y'
|
||||||
|
&& pInput.read() == 'P' && pInput.read() == 'E') {
|
||||||
|
// This is the DOCTYPE declaration
|
||||||
|
while (Character.isWhitespace((char) (b = pInput.read()))) {
|
||||||
|
// Skip over WS
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b == 's' && pInput.read() == 'v' && pInput.read() == 'g') {
|
||||||
|
// It's SVG, identified by DOCTYPE
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DOCTYPE found, but not SVG
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Something else, we'll skip
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// This is a normal tag
|
||||||
|
if (buffer[0] == 's' && buffer[1] == 'v' && buffer[2] == 'g'
|
||||||
|
&& (Character.isWhitespace((char) buffer[3]) || buffer[3] == ':')) {
|
||||||
|
// It's SVG, identified by root tag
|
||||||
// TODO: Support svg with prefix + recognize namespace (http://www.w3.org/2000/svg)!
|
// TODO: Support svg with prefix + recognize namespace (http://www.w3.org/2000/svg)!
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is not a comment, or the DOCTYPE declaration, the doc has no DOCTYPE and it can't be svg
|
// If the tag is not "svg", this isn't SVG
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There might be comments before the doctype, unfortunately...
|
while (pInput.read() != '<') {
|
||||||
// If next is "--", this is a comment
|
// Skip over, until next begin tag
|
||||||
if ((b = pInput.read()) == '-' && pInput.read() == '-') {
|
|
||||||
while (!(pInput.read() == '-' && pInput.read() == '-' && pInput.read() == '>')) {
|
|
||||||
// Skip until end of comment
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we are lucky, this is DOCTYPE declaration
|
|
||||||
if (b == 'D' && pInput.read() == 'O' && pInput.read() == 'C' && pInput.read() == 'T'
|
|
||||||
&& pInput.read() == 'Y' && pInput.read() == 'P' && pInput.read() == 'E') {
|
|
||||||
docTypeFound = true;
|
|
||||||
while (Character.isWhitespace((char) (b = pInput.read()))) {
|
|
||||||
// Skip over WS
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b == 's' && pInput.read() == 'v' && pInput.read() == 'g') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (EOFException ignore) {
|
||||||
|
// Possible for small files...
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
+2
-1
@@ -59,7 +59,8 @@ public class SVGImageReaderTest extends ImageReaderAbstractTest<SVGImageReader>
|
|||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new TestData(getClassLoaderResource("/svg/batikLogo.svg"), new Dimension(450, 500)),
|
new TestData(getClassLoaderResource("/svg/batikLogo.svg"), new Dimension(450, 500)),
|
||||||
new TestData(getClassLoaderResource("/svg/red-square.svg"), new Dimension(100, 100)),
|
new TestData(getClassLoaderResource("/svg/red-square.svg"), new Dimension(100, 100)),
|
||||||
new TestData(getClassLoaderResource("/svg/blue-square.svg"), new Dimension(100, 100))
|
new TestData(getClassLoaderResource("/svg/blue-square.svg"), new Dimension(100, 100)),
|
||||||
|
new TestData(getClassLoaderResource("/svg/Android_robot.svg"), new Dimension(400, 400))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-147 -70 294 345">
|
||||||
|
<g fill="#a4c639">
|
||||||
|
<use stroke-width="14.4" xlink:href="#b" stroke="#FFF"/>
|
||||||
|
<use xlink:href="#a" transform="scale(-1,1)"/>
|
||||||
|
<g id="a" stroke="#FFF" stroke-width="7.2">
|
||||||
|
<rect rx="6.5" transform="rotate(29)" height="86" width="13" y="-86" x="14"/>
|
||||||
|
<rect id="c" rx="24" height="133" width="48" y="41" x="-143"/>
|
||||||
|
<use y="97" x="85" xlink:href="#c"/>
|
||||||
|
</g>
|
||||||
|
<g id="b">
|
||||||
|
<ellipse cy="41" rx="91" ry="84"/>
|
||||||
|
<rect rx="22" height="182" width="182" y="20" x="-91"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g stroke="#FFF" stroke-width="7.2" fill="#FFF">
|
||||||
|
<path d="m-95 44.5h190"/><circle cx="-42" r="4"/><circle cx="42" r="4"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 706 B |
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-bmp</artifactId>
|
<artifactId>imageio-bmp</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: BMP plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: BMP plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-clippath</artifactId>
|
<artifactId>imageio-clippath</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Photoshop Path Support</name>
|
<name>TwelveMonkeys :: ImageIO :: Photoshop Path Support</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-core</artifactId>
|
<artifactId>imageio-core</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Core</name>
|
<name>TwelveMonkeys :: ImageIO :: Core</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-hdr</artifactId>
|
<artifactId>imageio-hdr</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: HDR plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: HDR plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-icns</artifactId>
|
<artifactId>imageio-icns</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: ICNS plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: ICNS plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-iff</artifactId>
|
<artifactId>imageio-iff</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: IFF plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: IFF plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-jpeg</artifactId>
|
<artifactId>imageio-jpeg</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: JPEG plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: JPEG plugin</name>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>imageio-metadata</artifactId>
|
<artifactId>imageio-metadata</artifactId>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pcx</artifactId>
|
<artifactId>imageio-pcx</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PCX plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PCX plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pdf</artifactId>
|
<artifactId>imageio-pdf</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PDF plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PDF plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pict</artifactId>
|
<artifactId>imageio-pict</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PICT plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PICT plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-pnm</artifactId>
|
<artifactId>imageio-pnm</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PNM plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PNM plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-psd</artifactId>
|
<artifactId>imageio-psd</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: PSD plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: PSD plugin</name>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
- Implement source subsampling and region of interest
|
|
||||||
- Separate package for the resources (seems to be a lot)?
|
- Separate package for the resources (seems to be a lot)?
|
||||||
- Move to metadata package, or implement metadata interface, as this is (similar|equivalent) to TIFF/JPEG APP13 segment tag?
|
- Move to metadata package, or implement metadata interface, as this is (similar|equivalent) to TIFF/JPEG APP13 segment tag?
|
||||||
- Possibility to read only some resources? readResources(int[] resourceKeys)?
|
- Possibility to read only some resources? readResources(int[] resourceKeys)?
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-reference</artifactId>
|
<artifactId>imageio-reference</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: reference test cases</name>
|
<name>TwelveMonkeys :: ImageIO :: reference test cases</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-sgi</artifactId>
|
<artifactId>imageio-sgi</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: SGI plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: SGI plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-tga</artifactId>
|
<artifactId>imageio-tga</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: TGA plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: TGA plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-thumbsdb</artifactId>
|
<artifactId>imageio-thumbsdb</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: Thumbs.db plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: Thumbs.db plugin</name>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
<artifactId>imageio</artifactId>
|
<artifactId>imageio</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>imageio-tiff</artifactId>
|
<artifactId>imageio-tiff</artifactId>
|
||||||
<name>TwelveMonkeys :: ImageIO :: TIFF plugin</name>
|
<name>TwelveMonkeys :: ImageIO :: TIFF plugin</name>
|
||||||
|
|||||||
+1
-1
@@ -219,7 +219,7 @@ public class CCITTFaxEncoderStream extends OutputStream {
|
|||||||
while (nonterm > 0) {
|
while (nonterm > 0) {
|
||||||
if (nonterm >= codes.length) {
|
if (nonterm >= codes.length) {
|
||||||
write(codes[codes.length - 1].code, codes[codes.length - 1].length);
|
write(codes[codes.length - 1].code, codes[codes.length - 1].length);
|
||||||
nonterm -= codes.length - 1;
|
nonterm -= codes.length;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
write(codes[nonterm - 1].code, codes[nonterm - 1].length);
|
write(codes[nonterm - 1].code, codes[nonterm - 1].length);
|
||||||
|
|||||||
+2
-2
@@ -125,7 +125,7 @@ public class TIFFImageReader extends ImageReaderBase {
|
|||||||
// TODO: Tiling support (readTile, readTileRaster)
|
// TODO: Tiling support (readTile, readTileRaster)
|
||||||
// TODO: Implement readAsRenderedImage to allow tiled RenderedImage?
|
// TODO: Implement readAsRenderedImage to allow tiled RenderedImage?
|
||||||
// For some layouts, we could do reads super-fast with a memory mapped buffer.
|
// For some layouts, we could do reads super-fast with a memory mapped buffer.
|
||||||
// TODO: Implement readAsRaster directly
|
// TODO: Implement readAsRaster directly (100% correctly)
|
||||||
// http://download.java.net/media/jai-imageio/javadoc/1.1/com/sun/media/imageio/plugins/tiff/package-summary.html#ImageMetadata
|
// http://download.java.net/media/jai-imageio/javadoc/1.1/com/sun/media/imageio/plugins/tiff/package-summary.html#ImageMetadata
|
||||||
|
|
||||||
// TODOs Extension support
|
// TODOs Extension support
|
||||||
@@ -134,7 +134,7 @@ public class TIFFImageReader extends ImageReaderBase {
|
|||||||
// TODO: Support Compression 34661 (JBIG)? Depends on JBIG ImageReader
|
// TODO: Support Compression 34661 (JBIG)? Depends on JBIG ImageReader
|
||||||
|
|
||||||
// DONE:
|
// DONE:
|
||||||
// Handle SampleFormat (and give up if not == 1)
|
// Handle SampleFormat
|
||||||
// Support Compression 6 ('Old-style' JPEG)
|
// Support Compression 6 ('Old-style' JPEG)
|
||||||
// Support Compression 2 (CCITT Modified Huffman RLE) for bi-level images
|
// Support Compression 2 (CCITT Modified Huffman RLE) for bi-level images
|
||||||
// Source region
|
// Source region
|
||||||
|
|||||||
+27
@@ -43,6 +43,7 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.awt.image.DataBufferByte;
|
import java.awt.image.DataBufferByte;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
@@ -124,6 +125,32 @@ public class CCITTFaxEncoderStreamTest {
|
|||||||
testImage(getClassLoaderResource("/tiff/fivepages-scan-causingerrors.tif"));
|
testImage(getClassLoaderResource("/tiff/fivepages-scan-causingerrors.tif"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for "Fixed an issue with long runlengths in CCITTFax writing #188"
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testRunlengthIssue() throws IOException {
|
||||||
|
byte[] data = new byte[400];
|
||||||
|
Arrays.fill(data, (byte) 0xFF);
|
||||||
|
data[0] = 0;
|
||||||
|
data[399] = 0;
|
||||||
|
|
||||||
|
ByteArrayOutputStream imageOutput = new ByteArrayOutputStream();
|
||||||
|
OutputStream outputSteam = new CCITTFaxEncoderStream(imageOutput, 3200, 1, TIFFExtension.COMPRESSION_CCITT_T6, 1, 0L);
|
||||||
|
outputSteam.write(data);
|
||||||
|
outputSteam.close();
|
||||||
|
byte[] encodedData = imageOutput.toByteArray();
|
||||||
|
|
||||||
|
byte[] decodedData = new byte[data.length];
|
||||||
|
CCITTFaxDecoderStream inputStream = new CCITTFaxDecoderStream(new ByteArrayInputStream(encodedData), 3200, TIFFExtension.COMPRESSION_CCITT_T6, 1, 0L);
|
||||||
|
new DataInputStream(inputStream).readFully(decodedData);
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
|
assertArrayEquals(data, decodedData);
|
||||||
|
}
|
||||||
|
|
||||||
protected URL getClassLoaderResource(final String pName) {
|
protected URL getClassLoaderResource(final String pName) {
|
||||||
return getClass().getResource(pName);
|
return getClass().getResource(pName);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Twelvemonkeys</name>
|
<name>Twelvemonkeys</name>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.twelvemonkeys</groupId>
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
<artifactId>twelvemonkeys</artifactId>
|
<artifactId>twelvemonkeys</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
Reference in New Issue
Block a user