Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Progress of animation.save (for long animations) #13561

Closed
@SBCV

Description

@SBCV

Storing long animations with animation.save() takes unfortunately a considerable amount of time. Currently, there is (afaik) no possibility to see the progress of the process and it is unclear if the program is running for minutes or hours.
In my opinion it would be very valuable, if there would be some option to enable user feedback / logging information. For example: anim.save(output_path, writer, log_progress=True)

The desired logging information can be added with with a small amount of additional lines:

Original code:

for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
    for anim, d in zip(all_anim, data):
        # TODO: See if turning off blit is really necessary
        anim._draw_next_frame(d, blit=False)
    writer.grab_frame(**savefig_kwargs)

With logging:

frame_number = 0
number_frames = sum([a.save_count for a in all_anim])
for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
    for anim, d in zip(all_anim, data):
        # TODO: See if turning off blit is really necessary
        anim._draw_next_frame(d, blit=False)
        if log_progress and frame_number % 100 == 0:
            _log.info('frame ' + str(frame_number) + ' of ' + str(number_frames))
            frame_number +=1
    writer.grab_frame(**savefig_kwargs)

If this is valuable for others, I can create a pull request.
Please let me know, If this such logging is already possible with some other built-in option.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions