Xah Lee, 2006-04
On my website there are several projects that has the form of a photo gallery. Typically, there are a set of html files, each one has 5 to 10 inline images. I need to generate thumbnail for each image that has a existing inline link.
For example, you can goto the following website and see the result of using this script:
To create a thumbnail image, i use the command line software ImageMagick (see: ImageMagick Tutorial). However, i only want to generate thumbnails based on images that have a existing inline link. So, i'll essentially have to parse these html files to find which image i need thumbnail first. Also, the images are located in directories, not all flatly in one directory. I need the thumbnails created in a path that mirrors their file path.
So, for example, suppose “<img src="_p/Gustave_Dore/Dore_red_ridinghood.png">” is a inline link. Then, the thumbnail for that image will be at “thumbnail/_p/Gustave_Dore/Dore_red_ridinghood.png”.
Here's the solution for this task: tn_gen.py.
See also:
Page created: 2006-04. © 2006 by Xah Lee.