Browse Source

Initial mirror from https://github.com/marcusficner/ImageList.git

This repository was automatically mirrored.
mitch donaberger 3 months ago
commit
af91176d03
3 changed files with 116 additions and 0 deletions
  1. 38 0
      .gitignore
  2. 58 0
      ImageList.py
  3. 20 0
      README.md

+ 38 - 0
.gitignore

@@ -0,0 +1,38 @@
+*.py[cod]
+
+# C extensions
+*.so
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+lib
+lib64
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+nosetests.xml
+
+# Translations
+*.mo
+
+# Mr Developer
+.mr.developer.cfg
+.project
+.pydevproject
+
+#Pycharm
+.idea

+ 58 - 0
ImageList.py

@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+import Image
+import sys
+import fnmatch
+import os
+
+the_path = sys.argv[1]
+
+files = []
+for root, dirnames, filenames in os.walk(the_path):
+  for filename in fnmatch.filter(filenames, '*.png'):
+      files.append(os.path.join(root, filename))
+
+htmlPrefix = '''<html>
+                <head>
+                  <style type="text/css">
+                    body { background-color:#e4e8e9; }
+                    table {
+                      border:none;
+                      border-collapse: collapse;
+                    }
+
+                    table td {
+                      border-bottom: 1px solid #000;
+                      padding: 10px
+                    }
+
+                    table td:first-child {
+                      border-left: none;
+                    }
+
+                    table td:last-child {
+                     border-right: none;
+                    }
+                    td { font-family:"Tahoma"; }
+                    img { max-width:300px;
+                               height:auto
+                     }
+                  </style>
+                </head>
+                <body>'''
+htmlSuffix = '''</body>
+                </html>'''
+
+body = ""
+body+= "<table>"
+
+for file in files:
+    img = Image.open(file)
+    path,filename = os.path.split(file)
+    width,height = img.size
+    body+= r'<tr><td>'+'<a href="'+file+'"><img src='+file+'></a>'+'</td><td>'+ filename + ", " + str(width)+ " x " +str(height) +r'</td></tr>'
+
+body+= "</table>"
+
+f = open('index.html', 'w')
+f.write(htmlPrefix+body+htmlSuffix)

+ 20 - 0
README.md

@@ -0,0 +1,20 @@
+![Notice, this repository was mirrored to here from Github](https://m1s5.c20.e2-5.dev/files/images/mirror-notice.svg)
+
+ImageList
+=========
+
+Script that lists all images from a directory in a html page.
+
+### Usage
+
+Make the script executable
+`chmod a+x ImageList.py`
+
+`$ ./ImageList.py _path_to_directory_`
+
+### Example output
+![](https://raw.github.com/wiki/mficner/ImageList/files/example.png)
+
+
+## Dependency
+* PIL - [Python Image Library](http://www.pythonware.com/products/pil)