我想将 TGA 文件读取到BufferedImage
. 没有图书馆我怎么能做到?
现在有功能:
(defn load-image [filename]
(ImageIO/read (File. filename)))
此函数成功读取 jpeg 文件,但返回nil
TGA 文件而不是 BufferedImage。
我想将 TGA 文件读取到BufferedImage
. 没有图书馆我怎么能做到?
现在有功能:
(defn load-image [filename]
(ImageIO/read (File. filename)))
此函数成功读取 jpeg 文件,但返回nil
TGA 文件而不是 BufferedImage。
最简单的事情仍然是使用库,例如 TwelveMonkeys。在您的project.clj
(如果您使用 Leiningen)中,添加:
{:dependencies [... [com.twelvemonkeys.imageio/imageio-tga "3.4.1"]]}
然后,在代码中:
(ImageIO/scanForPlugins)
(defn load-image [filename]
(ImageIO/read (File. filename)))
这适用于有效的 TGA 文件。