X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2FImageUtils.java;h=9f1e06f36806d57c3876dc38b6400d4d4b371412;hb=11f9e5f37c2570f0376a4c1898c6aea3a7f28fc7;hp=afeb5d34dd924ff4f5dd4102e548ef2a3015b1d8;hpb=16c492f5ea1daa04ee29be168f44f53c35bd52cd;p=fanfix.git diff --git a/src/be/nikiroo/utils/ImageUtils.java b/src/be/nikiroo/utils/ImageUtils.java index afeb5d3..9f1e06f 100644 --- a/src/be/nikiroo/utils/ImageUtils.java +++ b/src/be/nikiroo/utils/ImageUtils.java @@ -101,7 +101,7 @@ public class ImageUtils { return fileString; } - + /** * Convert the given Base64 representation of an image into an {@link Image} * object. @@ -136,9 +136,17 @@ public class ImageUtils { static public BufferedImage fromStream(InputStream in) throws IOException { MarkableFileInputStream tmpIn = null; File tmp = null; - try { - in.reset(); - } catch (IOException e) { + + boolean repack = !in.markSupported(); + if (!repack) { + try { + in.reset(); + } catch (IOException e) { + repack = true; + } + } + + if (repack) { tmp = File.createTempFile(".tmp-image", ".tmp"); tmp.deleteOnExit(); IOUtils.write(in, tmp);