可以使用 file 命令来判断文件是否是图片,命令如下:

file filename

如果文件是图片,输出会包含 "image" 字样,例如:

$ file test.jpg
test.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, baseline, precision 8, 640x480, components 3

如果文件不是图片,则输出会包含其他类型信息。


原文地址: https://www.cveoy.top/t/topic/gESu 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录