mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Merge pull request #19 from guinotphil/spifix
Fix issue with JMagick Spi Providers
This commit is contained in:
commit
af245a80d9
@ -46,7 +46,7 @@ import java.util.Locale;
|
|||||||
*/
|
*/
|
||||||
abstract class JMagickImageReaderSpiSupport extends ImageReaderSpi {
|
abstract class JMagickImageReaderSpiSupport extends ImageReaderSpi {
|
||||||
|
|
||||||
final static boolean AVAILABLE = SystemUtil.isClassAvailable("com.twelvemonkeys.imageio.plugins.jmagick.JMagick");
|
final static boolean AVAILABLE = SystemUtil.isClassAvailable("com.twelvemonkeys.imageio.plugins.jmagick.JMagick", JMagickImageReaderSpiSupport.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a JMagickImageReaderSpiSupport
|
* Creates a JMagickImageReaderSpiSupport
|
||||||
|
@ -52,12 +52,13 @@ public class JPEGImageReaderSpi extends JMagickImageReaderSpiSupport {
|
|||||||
boolean canDecode(ImageInputStream pSource) throws IOException {
|
boolean canDecode(ImageInputStream pSource) throws IOException {
|
||||||
// new byte[][] {new byte[] {(byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xe0},
|
// new byte[][] {new byte[] {(byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xe0},
|
||||||
// new byte[] {(byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xe1}}, // JPEG
|
// new byte[] {(byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xe1}}, // JPEG
|
||||||
|
// new byte[][] {new byte[] {(byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xed}}, // PHOTOSHOP 3 JPEG
|
||||||
// new byte[][] {new byte[] {(byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xee}}, // JPG
|
// new byte[][] {new byte[] {(byte) 0xff, (byte) 0xd8, (byte) 0xff, (byte) 0xee}}, // JPG
|
||||||
byte[] magic = new byte[4];
|
byte[] magic = new byte[4];
|
||||||
pSource.readFully(magic);
|
pSource.readFully(magic);
|
||||||
|
|
||||||
return magic[0] == (byte) 0xFF && magic[1] == (byte) 0xD8 && magic[2] == (byte) 0xFF &&
|
return magic[0] == (byte) 0xFF && magic[1] == (byte) 0xD8 && magic[2] == (byte) 0xFF &&
|
||||||
(magic[3] == (byte) 0xE0 || magic[0] == (byte) 0xE1 || magic[0] == (byte) 0xEE);
|
(magic[3] == (byte) 0xE0 || magic[3] == (byte) 0xE1 || magic[3] == (byte) 0xED || magic[3] == (byte) 0xEE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,11 @@ public class TargaImageReaderSpi extends JMagickImageReaderSpiSupport {
|
|||||||
// new byte[] {-1, 0x01, 0x20}, // Type 31: Compressed CM
|
// new byte[] {-1, 0x01, 0x20}, // Type 31: Compressed CM
|
||||||
// new byte[] {-1, 0x01, 0x21}, // Type 32: Compressed CM, 4 pass
|
// new byte[] {-1, 0x01, 0x21}, // Type 32: Compressed CM, 4 pass
|
||||||
// },
|
// },
|
||||||
pSource.seek(pSource.length() - 18);
|
try {
|
||||||
|
pSource.seek(pSource.length() - 18);
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
byte[] magic = new byte[18];
|
byte[] magic = new byte[18];
|
||||||
pSource.readFully(magic);
|
pSource.readFully(magic);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user