Skip to content

Commit

Permalink
[build] Add delete_duplicate_images.py script to replace --skip-idle
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcNumworks authored and PiaNumworks committed Apr 15, 2024
1 parent 3868924 commit 5465c08
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions build/screenshots/delete_duplicate_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import argparse
import pathlib

parser = argparse.ArgumentParser(
description="This script deletes successions of duplicated images in the folder, leaving just one per event entailing a visual change."
)
parser.add_argument(
"-o", "--output-folder", default="screenshots_each_step", help="output folder"
)


def main():
args = parser.parse_args()
folder = pathlib.Path(args.output_folder) / "images"
# Compare png contents and remove successive duplicates
previousImage = b""
for png in sorted(folder.glob("img-*.png")):
image = png.read_bytes()
if image == previousImage:
png.unlink()
else:
previousImage = image


if __name__ == "__main__":
main()

0 comments on commit 5465c08

Please sign in to comment.