使用 Imagemagick Convert 调整图像大小
我有一张尺寸为 1280x720 的 YUV420 图像。我正在尝试使用以下命令行选项使用 Convert (Imagemagick) 将其大小调整为 720x576。但生成的输出文件似乎不是正确调整大小的 YUV420 图像(我希望调整大小的输出也为 YUV420 格式):
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -filter lanczos -resize 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv //Here the output file size is not what it should be of a 720x576 YUV420 file which is 720x576x1.5 bytes.
Qiestion:那么这个输出文件的格式是什么?
还尝试了 -sample 选项,但结果相同。输出文件大小不正确。我什至尝试显示生成的调整大小的文件,但它肯定不是 YUV420 文件,因为根本无法正确查看它。
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -sample 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv
问题:convert 能够完成我想要完成的事情吗?如果是,有哪些选择?
问题:还有其他工具(免费软件、共享软件)可以帮助我将 YUV 文件(不同格式的 YUV420、YUV444)大小调整为 YUV 格式输出文件吗?
I have a YUV420 image of size 1280x720. I am trying to resize it to 720x576 using convert (Imagemagick) using below commandline options. But the generated output file doesnot seem to be a proper resized YUV420 image(I want the resized output also to be in YUV420 format):
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -filter lanczos -resize 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv //Here the output file size is not what it should be of a 720x576 YUV420 file which is 720x576x1.5 bytes.
Qiestion: What is the format of this output file then?
Also tried -sample option as, but same result. Incorrect sized output file. I even tried to display the generated resized file, but it sure is not a YUV420 file, as could not view it correctly at all.
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -sample 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv
Question: Would convert be able to do what I am trying to get done? IF yes, what are the options?
Question: Any other tool(freeware,shareware) which could help me resize YUV files(different formats YUV420, YUV444) to YUV format output files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试忽略宽高比!
忽略纵横比('!'标志)
如果您愿意,可以强制“-resize”忽略宽高比并扭曲图像,以便它始终生成与指定尺寸完全相同的图像。这是通过添加字符“!”来完成的到尺寸。不幸的是,这个字符有时也被各种 UNIX 命令行 shell 用于特殊目的。因此,您可能必须以某种方式转义该角色才能保留它。
例子:
Try to ignore aspect ration!
Ignore Aspect Ratio ('!' flag)
If you want you can force "-resize" to ignore the aspect ratio and distort the image so it always generates an image exactly the size specified. This is done by adding the character '!' to the size. Unfortunately this character is also sometimes used for special purposes by various UNIX command line shells. So you may have to escape the character somehow to preserve it.
Example: