Skip to content

Commit

Permalink
improve resizing script
Browse files Browse the repository at this point in the history
  • Loading branch information
ewei068 committed Jan 5, 2025
1 parent 873fff2 commit 2de3cf4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Binary file added media/images/sprites/magma-groudon-resized.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed media/images/sprites/magma-groudon-resized.png
Binary file not shown.
6 changes: 5 additions & 1 deletion scripts/dev/resize_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ def resize_images_in_directory(directory, new_size):
for frame in ImageSequence.Iterator(image):
# Resize the frame
frame_resized = frame.resize(new_size, Image.LANCZOS)
frame_resized = frame_resized.convert("RGBA")

frames.append(frame_resized)
# Get the duration of the frame
durations.append(frame.info["duration"])

output_path = os.path.join(directory, f"{image_name}-resized.png")
output_path = os.path.join(directory, f"{image_name}-resized.gif")
frames[0].save(
output_path,
save_all=True,
append_images=frames[1:],
loop=0,
duration=durations,
transparency=0,
disposal=2,
)
else:
# Handle non-animated images
Expand Down

0 comments on commit 2de3cf4

Please sign in to comment.