imagemagick Convert -crop 前面带有管道

发布于 2025-01-15 18:06:58 字数 571 浏览 2 评论 0原文

我想使用 imagemagick 裁剪图像。 但是,imagemagick 将接收图像数据并通过之前的管道进行裁剪:

exiftool -b -RawThermalImage image1.jpg | convert .....-crop.....

我不确定要在“.....-crop.....”中放入什么,以将接收到的图像数据裁剪为特定的区域。请指导。

通常,在转换后,会指定一个图像进行裁剪,如下所示:

convert rose: -crop 1x1+3+3 cropped.gif

但是,在这种情况下,鉴于图像是从管道传入的,我对如何完成此命令感到困惑。

图片链接: https://drive.google.com/file/d/14h3z0yFK_9_f2puzbhLUm3D50MDMMnu2/查看?usp=共享

I want to use imagemagick to crop an image.
However, imagemagick will be receiving the image data to crop through a pipe before it:

exiftool -b -RawThermalImage image1.jpg | convert .....-crop.....

I am not sure what to put in the ".....-crop.....", to crop the image data received to a specific area. Please guide.

Usually, after convert, an image is specified for cropping like:

convert rose: -crop 1x1+3+3 cropped.gif

But, in this case, I am confused as to how to complete this command given that the image is coming in from the pipe.

ImageLink:
https://drive.google.com/file/d/14h3z0yFK_9_f2puzbhLUm3D50MDMMnu2/view?usp=sharing

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不再见 2025-01-22 18:06:58

更新答案

事实证明,问题是由于无意中使用GraphicsMagick而不是ImageMagick引起的。

原始答案

如果该流具有众所周知的幻数(签名),您应该能够使用破折号-来引用stdin在开始时:

exiftool -b -RawThermalImage image1.jpg | convert - -crop ... result.jpg

如果流是原始的,或者没有已知的幻数/签名,则需要给 ImageMagick 一个提示,因此如果它是具有形状的原始灰度 8 位数据640x480,使用:

exiftool -b -RawThermalImage image1.jpg | convert -size 640x480 -depth 8 GRAY:- -crop ... result.jpg

如果是大小为80x80的RGB888数据,则使用:

exiftool -b -RawThermalImage image1.jpg | convert -depth 8 -size 80x80 RGB:- -crop ... result.jpg

Updated Answer

It transpires that the problem was caused by inadvertently using GraphicsMagick rather than ImageMagick.

Original Answer

You should be able to use a dash - to refer to the stdin if that stream has a well-known magic number (signature) at the start:

exiftool -b -RawThermalImage image1.jpg | convert - -crop ... result.jpg

If the stream is raw, or doesn't have a known magic number/signature, you will need to give ImageMagick a hint, so if it is raw greyscale 8-bit data with shape 640x480, use:

exiftool -b -RawThermalImage image1.jpg | convert -size 640x480 -depth 8 GRAY:- -crop ... result.jpg

If it's RGB888 data with size 80x80, use:

exiftool -b -RawThermalImage image1.jpg | convert -depth 8 -size 80x80 RGB:- -crop ... result.jpg
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文