当字节从 stdin 传递并从 stdout 读取时,图形魔法旋转 90

graphics magicks rotation 90 when bytes is passed from stdin and read from stdout

当我尝试传递一个 exif 旋转为 90 的 jpeg 并尝试调整大小时,我的调整大小图像被损坏。现在的修复是将图像作为文件传递,并将输出也作为文件读取。目前我正在直接从我的 Java processBuilder.

读取和写入来自 stdin 和 stdout 的字节

有谁知道为什么会出现这个问题?

gm convert -limit threads 4 -limit Memory 512M -limit Map 1024M -limit Disk 1024M -size 2048x1458 - -flatten -sharpen 1.00x0.95 -rotate 90 -scale '2048x2048>' +profile !icm,* -interlace None -type TrueColor -quality 93 -sampling-factor 1x1 jpeg:-

更新: 这与旋转无关。 问题是因为 jpeg 在文件末尾有一些预告片。

………… JPEG格式RST7 JPEG 格式 RST0 JPEG 意向书 三星预告片(偏移量 0x1ba3ed 处 129 字节):

gm 识别给出以下结果

rotate_1_37658078940_605a46_o.jpg JPEG 2592x1944+0+0 DirectClass 8 位 1.7M 0.000u 0:01

gm 识别:顺序 JPEG (rotate_1_37658078940_605a46_o.jpg) 的 SOS 参数无效。

Graphics Magick 转换没有问题。由于 stderr 与 stdout(bytes) 合并,redirectError 流被设置为 true。