I use a Macbook pro 13inch retina, and manage photos taken with an iPad or digital camera using the "photo app" that comes with the Mac. However, from the need to collect only the photos of one group such as girlfriend's photos in another folder for management and viewing, I made a program to display the JPG image copied to one folder as a thumbnail in html. I tried it. I haven't actually created thumbnails, just displayed them in small size on html.
It can also be used to store and manage the original image as it is, with the brightness corrected for ornamental purposes. By the way, the following is the command of ImageMagick, which is a command to brighten a dark photo. The larger the number, the brighter it is.
convert IMG_0461.JPG -sigmoidal-contrast 10,0% IMG_0461.jpg
convert IMG_0494.JPG -sigmoidal-contrast 7,0% IMG_0494.jpg
convert IMG_0333.JPG -sigmoidal-contrast 4,0% IMG_0333.jpg
py_pic.py
import os
from PIL import Image
filenames = os.listdir('./')
imgl=[]
ww=[]
hh=[]
for fname in sorted(filenames):
path, ext = os.path.splitext( os.path.basename(fname) )
if ext=='.JPG' and path[0:2]!='._':
pic=path+ext
im=Image.open(pic)
w=im.size[0]
h=im.size[1]
print(pic, w, h)
imgl=imgl+[pic]
ww=ww+[w]
hh=hh+[h]
f=open('maggie.html','w')
print('<html>',file=f)
print('<body>',file=f)
print('<table>',file=f)
n=len(imgl)
m=int(n/5)+1
k=-1
for i in range(0,m):
print('<tr>',file=f)
for j in range(0,5):
k=k+1
if k<=n-1:
pic=imgl[k]
w1=200
h1=int(hh[k]/ww[k]*200)
print('<td align="center"><img src="'+pic+'" alt="pic" width="'+str(w1)+'", height="'+str(h1)+'"><br><a href="'+pic+'">I'+pic+'<a></td>',file=f)
else:
print('<td></td>',file=f)
print('</tr>',file=f)
print('</table>',file=f)
print('</body>',file=f)
print('</html>',file=f)
f.close()
that's all
Recommended Posts