about searching
Put Image Size Into Filename
Sometimes it is useful to have image size written in filename (I needed it when I was browsing my collection of wallpapers). I could not find any tool which would automate this process, so I have decided to write one. Probably it is job for bash or Python but I like Java most, so it is Java CLI tool. I have used ImageInfo class to get image parameters.
That’s what it does:
- scans all parameters for options – there is only one valid option: -p which switches the tool from the dry mode (tool only shows what should be done) to the working mode
- for every non-option parameter:
- check if it is path to an image
- read image width and height from the file
- check if the file name already contains valid info about the image size
- if need be, remove invalid info from the file name
- put WIDTHxHEIGHT string at the beginning of the file name
Use it like this:
# to preview changes:
$ java -jar /some-path/into-filename.jar file1 file2 ... # you can use full file paths
# to rename files:
$ java -jar /some-path/into-filename.jar -p file1 file2 ...
And here is the jar: into-filename (Public Domain License)
| Print article | This entry was posted by Seweryn Niemiec on 2008-08-22 at 00:20, and is filed under Java. Follow any responses to this post through RSS 2.0. You can skip to the end and leave a response. Pinging is currently not allowed. |
about 3 days ago
I didn’t hear just about SEO something and I really needed to optimize my traffic! Specialists from the forum posting service who aided me with my optimization problems were very kind!