无法用imgcat显示3D打印机摄像头JPEG快照,转格式后才可正常显示
问题:3D打印机摄像头JPEG无法被imgcat识别,转换后可正常显示
我有一台带摄像头的3D打印机,通过URL http://my-printer/webcam/?action=snapshot&cacheBust=$(date +%s) 可获取摄像头快照。尝试用imgcat在终端显示该图片失败,但将下载的图片经convert或mogrify转换格式后,imgcat就能正常显示(但耗时更长)。无论通过浏览器保存、curl/wget下载,还是直接将URL传给imgcat,结果都一致。
为避免命令通过扩展名推断图片类型,我特意不给快照添加.jpeg扩展名。用file或exiftool检测快照文件,均显示其为标准JPEG格式:
~/Documents/scripts/bash/print-stats(✓)$ file images/snapshot images/snapshot: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 1920x1080, components 3
~/Documents/scripts/bash/print-stats(✓)$ exiftool images/snapshot ExifTool Version Number : 11.59 File Name : snapshot Directory : images File Size : 277 kB File Modification Date/Time : 2024:04:13 10:24:30-07:00 File Access Date/Time : 2024:04:13 11:04:45-07:00 File Inode Change Date/Time : 2024:04:13 10:24:30-07:00 File Permissions : rw-r--r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Resolution Unit : None X Resolution : 1 Y Resolution : 1 Image Width : 1920 Image Height : 1080 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 1920x1080 Megapixels : 2.1
但imgcat仍无法加载这张快照。将JPEG转成PNG后用imgcat可正常显示,但将PNG转回JPEG后又无法显示。我注意到该快照的file输出比普通JPEG信息少,尝试用convert设置相关参数也未解决问题。使用mogrify替代convert也会出现相同问题。
此外,该图片在Mac的任意图片查看器中均可正常打开。
我已生成以下命令的输出文件:
curl -ksL --verbose --compressed --insecure http://192.168.0.50/webcam/?action=snapshot --output snapshot.jpeg --dump-header snapshot-curl-headers.txt 2>snapshot-curl-verbose.txtidentify -verbose snapshot.jpeg > snapshot-identify-verbose.txtexiftool -verbose snapshot.jpeg > snapshot-exiftool-verbose.txtexiftool snapshot.jpeg > snapshot-exiftool.txt
请问这张从打印机摄像头下载的JPEG存在什么问题?
内容的提问来源于stack exchange,提问作者J H
相关产品推荐
相关产品推荐

