问题描述
我正在使用),GIF正确调整大小,符合预期:
这我目前正在调整图像的大小:
with image(filename =src.gif)as img:
img.resize(50,50)
img.save(dest.gif)
使用Image(filename =src.gif)作为img:
for img.sequence中的帧:
frame.resize(50,50)
frame.destroy()
img.save(dest.gif)
两者都产生与上面相同的结果。我做错了什么?
您可以尝试打开新目标图像
并将每一帧循环到:
使用Image()作为dst_image:
with Image(filename = src_path )作为src_image:
for src_image.sequence中的帧:
frame.resize(x,y)
dst_image.sequence.append(frame)
dst_image.save(filename = dst_path )
适合我。
I am using Wand 0.3.7 with ImageMagick 6.8.8-10 to batch-resize some animated GIF files I have. But for some reason, Wand only resizes one frame in the image, leaving the others at their original size.
Here is the original image I am trying to resize:
And here is the output from Wand:
If I use ImageMagick from the command line directly (following instructions from here), the GIF is correctly resized, as expected:
This is how I am currently resizing the image:
with Image(filename="src.gif") as img:
img.resize(50, 50)
img.save("dest.gif")
I have also tried iterating through each frame and resizing them individually:
with Image(filename="src.gif") as img:
for frame in img.sequence:
frame.resize(50, 50)
frame.destroy()
img.save("dest.gif")
Both produce the same result seen above. What am I doing wrong?
You might try opening a new target Image
and loop every frame into that:
with Image() as dst_image:
with Image(filename=src_path) as src_image:
for frame in src_image.sequence:
frame.resize(x, y)
dst_image.sequence.append(frame)
dst_image.save(filename=dst_path)
works for me.
这篇关于使用Wand + ImageMagick调整GIF大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!