开发者

Resizing an Image using Imagemagick convert

开发者 https://www.devze.com 2023-04-08 06:24 出处:网络
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 resiz

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 correc开发者_如何学运维tly 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?


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:

convert image.gif    -resize 64x64\!  resized_image.gif //Resized Image with ignore ratio option
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号