I think I got the hang of your problem. I checked the image you linked ( http://www.jthink.net/jaikoz/scratch/front.jpg ). Its due to Exif and JFIF standard.
when you are doing something like ImageIO.read('some file')
it invokes the default sun jpeg implementation com.sun.imageio.plugins.jpeg.JPEGImageReader
. Which used to have issues loading JFIF files BUG 6488904 (check the comment towards the end).
According to spec, both Exif and
JFIF demands that their respective
application marker segment must be the
first right after SOI (APP1 and APP0)
, so it is actually not possible per
spec for an JPEG file to be compliant
with both standards.
Though it was reported long time back
The workaround is to use JAI library (https://jai.dev.java.net/binary-builds.html#Release_builds). I am using Java (no native acceleration) version.
SeekableStream seekableStream = new FileSeekableStream(new File("front.jpg"));
ParameterBlock pb = new ParameterBlock();
pb.add(seekableStream);
BufferedImage image = JAI.create("jpeg", pb).getAsBufferedImage();
hope this will help.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…