• 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 -->
    

      

  • 相关阅读:
    python字符串操作
    老男孩购物车程序
    python数据类型,判断,循环
    Matplotlib 绘图参考手册
    numpy 基础知识
    numpy random 模块
    numpy 算术运算
    pandas 读写数据
    python 读写文本
    python--windows文件操作
  • 原文地址:https://www.cnblogs.com/fatetop/p/13949526.html
Copyright © 2020-2023  润新知