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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.