I have written scripts for rezise and display all photos of a folder on lcd160 with a pyboard.
It produce a deformation of photos... I have start to write something without deformation but I prefer ask there before produce more efforts... if simply somebody has better...
Thanks.
The first one rezise photo in bash language:
Code: Select all
#!/bin/bash
###script for rezise photos in "photos"'s folder for after can display them on lcd160 (160x128, no exif, color YCBr, taille < 15000 bytes (depend of the original quality, could need to be change))
###dependances: imagemagick, jhead
####creation of a new folder wich will contain alls rezised photos
cd photos/
mkdir lcd-photos
###rezise photo in good size, and a quality correct for me (depend of the quality of the original), and color's mode.
for file in *.jpg;
do
convert -resize 128x160\! -quality 70 -colorspace YCbCr $file lcd-photos/lcd-$file
done
###without deformation test
#cd $folder_name
#for file in *.jpg;
#do
# convert -resize 128x160 -quality 50 -colorspace YCbCr $file lcd-photos/lcd-$file
#done
#cd lcd-photos/
#for file in *.jpg;
#do
# composite -size 128x160 -xc: black -gravity center -colorspace YCbCr $file lcd-$file
#done
####destruction of exif data
cd lcd-photos ###ou non si utilisation marges...
for file in *.jpg;
do
jhead -purejpg $file
done
If someone has make it yet...
The second one run on pyboar and display alls photos:
Code: Select all
from lcd160cr import LCD160CR, PORTRAIT
from time import sleep
import os
os.chdir("/sd/photos")
buf = bytearray(15000)
def traitement_photo(photo):
with open(photo, 'rb') as f:
f.readinto(buf)
lcd = LCD160CR('X')
lcd.set_orient( PORTRAIT )
lcd.erase()
lcd.set_pos(0, 0)
lcd.jpeg(buf)
while True:
for photo in os.listdir():
traitement_photo(photo)
sleep(30)