Clear questions and runnable code
get the best and fastest answer
picwoodpecker -- a Tk program to choose and modify your photosby Discipulus (Monsignor)
|on Nov 30, 2016 at 08:37 UTC||Need Help??|
after months of sparetime works I'm proud to present you picwoodpecker my last Tk effort (now also on github).
It is application to review and copy pictures with many features.
Suggestions are welcome.Tests with exif tags from different cameras are even more welcome.
This software is dedicated to my parents, who need to see printed pictures -- 6 July 1966
perl picwoodpecker.pl [-s -d -debug -pr -wr -p -x -y -nothumbs -e -quality -pngcompression -df]
-s|src|source path the path where search for jpg files to be loaded Can be modified in the Tk interface
The program is aimed to let you to easely choose among photos and save one (or more) copy in the preferred format (jpg as default; gif png gd and gd2 are also available). The name of the copy is crafted using the timestamp when the photo was taken.
Basically the program will load all jpg files found globbing the path given with command line parameter -source or entered in the graphical interface, and foreach file will examine some exif tags to get sizes, timestamps and the thumbnail (if not present showing a black empty one).
Orientation of the image is handled automatically for thumbnails and main photo.
Advanced options are available to manipulate how many photos are copied, in which format and let you to postprocess via exiftool each created image.
A main control window and a display one are created. Optionally a third window is created to access the advanced copy options. The display window tends to take the focus being the program focused on displaying photos.
The control window contains:
The display window will starts showing a grid of thumbnails. The first one is selected. You can navigate the grid using right arrow and left arrow of the keyboard to move the current selection on or back.
up arrow and down arrow let you load previous or next grids of thumbanails.
Enter key will open the currently selected thumbanil in a bigger resolution ( determinted by photo ratio parameter) photo filling the whole window.
When just one photo is displayed right arrow and left arrow of the keyboard can be used to show next and previous photo while up arrow and down arrow bring you back to the thumbnail view.
In both control and display window space bar can be used to save the current photo and p key can be used to toggle autoplay. If autoplay is active the time between photos can be set in the control window. Please note that specifying a short amount of time (shorter than the time needed to load photos data) can produce weird showing behaviours.
This menu lets you to have a granular control about how original photo will be copied.
The allow overwrite if checked silently overwrite a photo wich has the same name of what is composed for the current one.
bypass original file elaboration (simple copy) make a copy of the original file using the new name but without processing it with GD
output file type lets you to choose among different file fomrmats (jpeg, gif, png, gd and gd2) and to set the quality (0-100) for jpeg ones. For png files the compression factor (0-9) can be specified only via the command line parameter -pngcompression
enable multiple copies is trickier. If enabled lets you to choose to copy the file many times, each one with a different resolution. In the multi copies pattern you can specify different resolutions in the format widthxheigth as in 800x600 or 1024x768 and for each format a copy will be created.
enable post processing can be used to postprocess every image with exiftool program that ships with Image::ExifTool module. You can use alternative program to postprocess your image inserting the full path in the program field. Arguments to such program can be also specified where $ can be used to refer to the full path of the original image. In the exiftool command line you can also specify @ to refer to the current file. So you can postprocess every copy using the following arguments:
-overwrite_original -all= -tagsFromFile $ -ImageSize -ImageWidth -ImageHeight -ThumbnailImage -Orientation -DateTimeOriginal
This exiftool command will be issued for every copy made, overwriting each exif tags in the copy, removing them all but taking some tag frome the original file and applying them to the copy. See the exiftool page for a lot of options this wonderful program lets you to use.
The program was tested against few different camera formats; i dont know if exif tags extracted are widely valid.
The autoplay feature does not plays well with little time intervals: infact when the interval is smaller than the overall time taken to load the the photo and to redesign the display i'll notice photos and information skipped and the timer going on. I tried fixing this using waitVisibility Tk method, with no luck.
This software and icons are copyright of Discipulus as found on www.perlmonks.org You may redistribute or modify it under the same term of Perl itself.