GQView is an image browser that can easily be configured to use external applicatin to extend its functionality. In "Edit > Preferences > Editors" there are ten entries that can be used to identify and enter the command strings. GQView provides a few macros to assist you:
By default, Editors 9 and 10 allow you to rotate jpeg images clockwise or counterclockwise using the jpegtran application, part of the jpeg tools. It would be nice to also flip the images to a mirror image. Add to, for example, Editor 8:
Mirror Image %vif jpegtran -flip horizontal -copy all -outfile %p_tmp %p; then mv %p_tmp %p;else rm %p_tmp;fi
All we did was to copy the command from Editor 9 and substitute -flip horizontal
for -rotate 90 and now we can generate a mirror image. The substitute command was determined by examining the man page for jpegtran.
Play Video Files
While GQView does not provide a media player, we can use the Editor function to permit the use of mplayer for this purpose. Note that by default, GQView filters file extensions so as not to display non-image files. You can easily add custom file extensions to the table at "Edit > Preferences > Filtering", or simply tick the box to disable file filtering. The entry is:
Mplayer mplayer %f
Strip EXIF Information
Another useful application is jhead which can manipulate EXIF information and EXIF thumbnail images that can be embedded in a jpeg image. It would be nice to easily strip EXIF information from images before they are uploaded to preserve your privacy. To do that, the entry is:
Strip EXIF %vjhead -purejpg %p
Notice we used two GQView macros: %v will display the results of our command in a new window and %p will run the command once for each file selected since jhead expects a single filename as an argument.
You should be able to extract any embedded thumbnail images with (untested):
Extract EXIF Thumbnail %vjhead -st "&i"_th.jpg %p
Remove Duplicate Files
If you want to remove duplicate files (of any type, not just jpeg) fdupes is a useful application. It does present a problem, however, since fdupes expects to see a directory path and not a filename; GQView lacks a macro for directory names. We need to fool GQView by getting the full path with `pwd` and using %f as a final argument (which will not be processed by fdupes) to trick GQView into running fdupes only once no matter how many files are selected (which is the behavior we want). By default, fdupes will keep the first occurrance of a file and delete all subsequent copies (as determined with md5sum). We want fdupes to run non-interactively as well. Look at the man page.
Remove Dupes %vfdupes -N -d `pwd` %f
Conclusion
Of course, jpegtrans, mplayer and fdupes can do other things and all it takes is an entry in the Editor table. You can also write your own scripts and call them from the GQView Editor table which can be accessed both from a right-click menu or a keyboard shortcut. We've also found it handy to add our favorite GUI text editor to the mix with leafpad %f. How about identifying an unknown file with %vfile %f ? Have fun.
UPDATE:
The venerable but abandoned GQView has been supplanted by a forked version, Geeqie. It offers a number of improvements, but adding editors has become a little more complicated. You now create *.desktop files, but they now provide a templte fil. You should choose a NAME, add the command to the EXEC= line and save the file, choosing an appropriate name other than new.desktop
Make Mirror ImagesMacro Description%f Inserts list of selected files, may occur only once.
%p Command is executed once for each selected file, may occur multiple times.
%v Display result of the command in an output window, must occur as the first two characters.
%V Displays output window when multiple files are selected.
Mirror Image %vif jpegtran -flip horizontal -copy all -outfile %p_tmp %p; then mv %p_tmp %p;else rm %p_tmp;fi
All we did was to copy the command from Editor 9 and substitute -flip horizontal
for -rotate 90 and now we can generate a mirror image. The substitute command was determined by examining the man page for jpegtran.
Play Video Files
While GQView does not provide a media player, we can use the Editor function to permit the use of mplayer for this purpose. Note that by default, GQView filters file extensions so as not to display non-image files. You can easily add custom file extensions to the table at "Edit > Preferences > Filtering", or simply tick the box to disable file filtering. The entry is:
Mplayer mplayer %f
Strip EXIF Information
Another useful application is jhead which can manipulate EXIF information and EXIF thumbnail images that can be embedded in a jpeg image. It would be nice to easily strip EXIF information from images before they are uploaded to preserve your privacy. To do that, the entry is:
Strip EXIF %vjhead -purejpg %p
Notice we used two GQView macros: %v will display the results of our command in a new window and %p will run the command once for each file selected since jhead expects a single filename as an argument.
You should be able to extract any embedded thumbnail images with (untested):
Extract EXIF Thumbnail %vjhead -st "&i"_th.jpg %p
Remove Duplicate Files
If you want to remove duplicate files (of any type, not just jpeg) fdupes is a useful application. It does present a problem, however, since fdupes expects to see a directory path and not a filename; GQView lacks a macro for directory names. We need to fool GQView by getting the full path with `pwd` and using %f as a final argument (which will not be processed by fdupes) to trick GQView into running fdupes only once no matter how many files are selected (which is the behavior we want). By default, fdupes will keep the first occurrance of a file and delete all subsequent copies (as determined with md5sum). We want fdupes to run non-interactively as well. Look at the man page.
Remove Dupes %vfdupes -N -d `pwd` %f
Conclusion
Of course, jpegtrans, mplayer and fdupes can do other things and all it takes is an entry in the Editor table. You can also write your own scripts and call them from the GQView Editor table which can be accessed both from a right-click menu or a keyboard shortcut. We've also found it handy to add our favorite GUI text editor to the mix with leafpad %f. How about identifying an unknown file with %vfile %f ? Have fun.
UPDATE:
The venerable but abandoned GQView has been supplanted by a forked version, Geeqie. It offers a number of improvements, but adding editors has become a little more complicated. You now create *.desktop files, but they now provide a templte fil. You should choose a NAME, add the command to the EXEC= line and save the file, choosing an appropriate name other than new.desktop
Comments