From 34002b7d6e4aabf7fbf9c0f618e5138d4ac80b36 Mon Sep 17 00:00:00 2001 From: B Horn Date: Sun, 12 Apr 2020 16:25:01 +0100 Subject: [PATCH 1/5] Make it support gifs + use the virtualenv even if not currently activated. --- Makefile | 8 +++----- selfie_bot/image_utils.py | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e1893d4..88e0e1b 100644 --- a/Makefile +++ b/Makefile @@ -11,20 +11,18 @@ run: montage git submodule init git submodule update virtualenv -p python3 .venv - source .venv/bin/activate - pip install -r requirements.txt + source .venv/bin/activate; pip install -r requirements.txt clean: rm -rf .venv images images-cropped logs contrib rm -f montage.jpg images: .venv - . .venv/bin/activate - python -m selfie_bot + . .venv/bin/activate; python -m selfie_bot images-cropped: images mkdir images-cropped | true convert -trim 'images/*' ./images-cropped/%04d.png montage: images-cropped - python ./contrib/collage_maker/collage_maker.py -f ./images-cropped -o montage.jpg -w 1920 -i 360 -s + . .venv/bin/activate; python ./contrib/collage_maker/collage_maker.py -f ./images-cropped -o montage.jpg -w 1920 -i 360 -s diff --git a/selfie_bot/image_utils.py b/selfie_bot/image_utils.py index ef0cecb..9ee2efa 100644 --- a/selfie_bot/image_utils.py +++ b/selfie_bot/image_utils.py @@ -23,6 +23,8 @@ def rotate_if_exif_specifies(image): # No rotation tag present, so we don't need to rotate logger.debug('EXIF data present but no rotation tag, so not transforming') return image + except AttributeError: + return image value_to_transform = { 1: (0, False), From c874a760b35b51780b8b1484559e6b56fdcec89f Mon Sep 17 00:00:00 2001 From: B Horn Date: Sun, 12 Apr 2020 16:29:10 +0100 Subject: [PATCH 2/5] allow just cleaning the images and not the venv --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 88e0e1b..41f977c 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,15 @@ run: montage virtualenv -p python3 .venv source .venv/bin/activate; pip install -r requirements.txt -clean: - rm -rf .venv images images-cropped logs contrib +cleanvenv: + rm -rf .venv + +cleanimages: + rm -rf images images-cropped logs contrib rm -f montage.jpg +clean: cleanvenv cleanimages + images: .venv . .venv/bin/activate; python -m selfie_bot From b9bb283cdafa2ca6d2d447d59701e04c390f09b4 Mon Sep 17 00:00:00 2001 From: B Horn Date: Sun, 12 Apr 2020 16:57:28 +0100 Subject: [PATCH 3/5] Added the horrizontal image generation. You need to up your imagemagick limits for this --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 41f977c..541b83b 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,7 @@ images-cropped: images montage: images-cropped . .venv/bin/activate; python ./contrib/collage_maker/collage_maker.py -f ./images-cropped -o montage.jpg -w 1920 -i 360 -s + + +montage-horizontal: images-cropped + montage -background none -geometry 1920x1080 -tile `ls ./images-cropped | wc -l`x1 ./images-cropped/* montage-horizontal.png From 68a0a6baa6f6a6f62d94d225853492e6a76f00cc Mon Sep 17 00:00:00 2001 From: B Horn Date: Sun, 12 Apr 2020 19:12:09 +0100 Subject: [PATCH 4/5] hack to fix generate the horizontal montage in batches --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 541b83b..7e413b4 100644 --- a/Makefile +++ b/Makefile @@ -34,4 +34,4 @@ montage: images-cropped montage-horizontal: images-cropped - montage -background none -geometry 1920x1080 -tile `ls ./images-cropped | wc -l`x1 ./images-cropped/* montage-horizontal.png + ls -d ./images-cropped/*.png | xargs -n 8 echo | xargs -I% bash -c "montage -background none -geometry 1920x1080 -tile x1 % out/montage-horizontal-\`dd if=/dev/urandom bs=1 count=4 2>/dev/null| xxd -ps\`.png" From dc78cb0c9cb97b1c116ebb9227255d3b819d94e1 Mon Sep 17 00:00:00 2001 From: B Horn Date: Sun, 12 Apr 2020 19:19:12 +0100 Subject: [PATCH 5/5] Make sure it uses everything --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7e413b4..57c88bf 100644 --- a/Makefile +++ b/Makefile @@ -34,4 +34,4 @@ montage: images-cropped montage-horizontal: images-cropped - ls -d ./images-cropped/*.png | xargs -n 8 echo | xargs -I% bash -c "montage -background none -geometry 1920x1080 -tile x1 % out/montage-horizontal-\`dd if=/dev/urandom bs=1 count=4 2>/dev/null| xxd -ps\`.png" + ls -d ./images-cropped/* | xargs -n 10 echo | xargs -I% bash -c "montage -background none -geometry 1920x1080 -tile x1 % out/montage-horizontal-\`dd if=/dev/urandom bs=1 count=4 2>/dev/null| xxd -ps\`.png"