• javaImageIO.read存在的javax.imageio.IIOException: Unsupported Image Type异常


    javax.imageio.IIOException: Unsupported Image Type
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1079)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1050)
    at javax.imageio.ImageIO.read(ImageIO.java:1448)
    at javax.imageio.ImageIO.read(ImageIO.java:1352)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

    -------------------------------

    ImageIO.read() 无法处理ps过后的图片

    P过的图片保存为jpg格式时,默认的模式是CMYK模式

    只能读取png模式

    解决方案

    使用插件

    https://github.com/haraldk/TwelveMonkeys

    mvn管理

    <!--图片处理 start -->
    <dependency>
        <groupId>com.twelvemonkeys.imageio</groupId>
        <artifactId>imageio-jpeg</artifactId>
        <version>3.6</version>
    </dependency>
    <dependency>
        <groupId>com.twelvemonkeys.imageio</groupId>
        <artifactId>imageio-tiff</artifactId>
        <version>3.6</version>
    </dependency>
    <!--
    Optional dependency. Needed only if you deploy `ImageIO` plugins as part of a web app.
    Make sure you add the `IIOProviderContextListener` to your `web.xml`, see above.
    -->
    <dependency>
        <groupId>com.twelvemonkeys.servlet</groupId>
        <artifactId>servlet</artifactId>
        <version>3.6</version>
    </dependency>
    <!--图片处理 end -->
    

      

  • 相关阅读:
    Go语言趣学指南lesson3
    简单的>this
    多媒体查询
    解析对象原型链
    笑对人生,坐看云起云落
    HTML5
    javascript函数及作用域的小结
    不得不知call()和apply()
    浅谈弹性盒子布局
    编译原理实验(算符优先文法)
  • 原文地址:https://www.cnblogs.com/fatetop/p/13949526.html
Copyright © 2020-2023  润新知