This is an application, which keep your image files to be small file sized. I build this application for my home-made server (ODROID N2+, Ubuntu 22.04).
This application is using ‘Pillow’ library to compress image files. It will compress image files in the source path and save them to the destination path. If the destination path is not exist, it will create it automatically. The original file will be deleted.
It keeps observing the source path, if there is a new image file, it will compress it and save it to the destination path while it is running.
Google Photos no longer provide unlimited storage for free, and I was bored.
- python3.11
- pip3
- virtualenv
You need to install more libraries, which are in the ‘requirements.txt’ file, after you create virtual environment and activate it.
sudo apt-get -y install python3.11 python3-pip virtualenv
# you probably use yum or something else. you would know.
git clone https://github.com/pjc1991/py-image-storage.git
cd py-image-storage
/usr/bin/python3.11 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
touch .env && vi .env
# .env
UNCOMPRESSED=\\NAS\FILES\uncompressed # uncompressed image files path, source path
COMPRESSED=\\NAS\FILES\compressed # compressed image files path, destination path
nohup python -u observer.py &
tail -f nohup.out
# or you just
./start.sh
# it gives you tail =f nohup.out
# to stop watching log : CTRL+C
ps -ef | grep observer.py
kill -9 <pid>
# or you just
./stop.sh
tail -f nohup.out
# or you just
./watch_logs.sh
- Implement async I/O
- Better performance and structures for async I/O
- Make a script for stopping application
- Make this application as a service (systemd)
- Make a script for installation (not sure if it is necessary
I tested this application on Ubuntu 22.04 (Odroid N2+) & Windows 11(My gaming desktop).
Well, It was fast as the file transfer speed of my server, at least.
Leave a Reply