View previous topic :: View next topic |
Author |
Message |
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Wed Jun 05, 2002 8:44 pm Post subject: Simple improvements KDE digital camera support |
|
|
Here are a couple of ideas for KDE users who have a collection of digital camera images.
1) Thumbnails. KDE 3 now allows you to change the threshold filesize for thumbnails to be generated in Konqueror. Go to the Control Center/File Browsing/File Manager/Previews tab and change the Maximum file size to something a bit bigger than your typical camera jpeg file size.
2) If your camera uses the USB mass storage protocol, make sure SCSI and USB support are both compiled into your kernel. Then add a line like
Code: | /dev/sda1 /mnt/camera auto user,sync,noauto 0 0 |
into your /etc/fstab, where /dev/sda1 is whatever device it is your camera appears at when you plug it in. You can then mount your camera just like a disk and drag files around in Konqueror.
3) Make sure that jpegtran (from media-libs/jpeg) and media-gfx/jhead are installed (do an emerge if necessary). The former does lossless transformations on jpegs, such as 90 degree rotations and changing baseline jpegs to progressive (for slightly smaller files and better optimisation on the web). The latter is for extracting digicam setting information from jpegs.
4) You can add the following shell script to Konqueror's contextual menu in order to rotate jpeg files from within the file manager (and make them into progressive jpegs while you are at it):
Code: | #!/bin/sh
until [ -z "$1" ]
do
mv "$1" "$1~"
jpegtran -optimise -progressive -rotate 270 -trim -copy all -outfile "$1" "$1~"
shift
done |
Save this with an appropriate name and make sure the file is executable. Right click in Konqueror on a jpeg file and choose Edit File Type.../Add... Find the shell script you saved earlier. It doesn't matter whether Run in terminal is selected. If it is, you get some visual feedback but it's not that helpful. Apply changes, then you can select the script by right-clicking on a jpeg file and chosing Open with...
5) The following script can be installed in the same way. It puts up a message box on the screen displaying any extra information your camera stores inside the jpeg, such as exposure, date and time, etc.
Code: | #!/bin/sh
until [ -z "$1" ]
do
TN="/tmp/`basename "$1"`.txt"
jhead "$1" > "$TN"
xmessage -center -default okay -file "$TN"
rm "$TN"
shift
done |
Ian |
|
Back to top |
|
|
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Sat Jul 27, 2002 9:38 pm Post subject: Better way... |
|
|
I've found a much better way to add the shell extensions than adding shell scripts as applications associated with jpegs. It is much better to use Konqueror Service Menus. This is based on the tutorial at http://developer.kde.org/documentation/tutorials/dot/servicemenus.html.
Create a file with the extension .desktop, in ~/.kde3/share/apps/konqueror/servicemenus. (To make it system-wide, you could put it in /usr/kde/3/share/apps/konqueror/servicemenus instead.) I called it rotatejpeg.desktop.
Put the following code in it:
Code: | [Desktop Entry]
ServiceTypes=image/jpeg
Actions=rotateLeft;rotateRight;makeProgressive;readComments
[Desktop Action rotateLeft]
Name=Rotate left
Icon=rotate_ccw
Exec=/bin/sh -c "mv %f %f~; jpegtran -optimise -progressive -rotate 270 -trim -copy all -outfile %f %f~"
[Desktop Action rotateRight]
Name=Rotate right
Icon=rotate_cw
Exec=/bin/sh -c "mv %f %f~; jpegtran -optimise -progressive -rotate 90 -trim -copy all -outfile %f %f~"
[Desktop Action makeProgressive]
Name=Make progressive
Icon=imagegallery
Exec=/bin/sh -c "mv %f %f~; jpegtran -optimise -progressive -copy all -outfile %f %f~"
[Desktop Action readComments]
Name=Comments
Icon=info
Exec=/bin/sh -c "jhead %f | xmessage -center -default okay -file -"
|
(You still need the jhead and jpegtran utilities installed somewhere in the default path of course.)
That's it. Right-click on a jpeg file. You'll even get pretty icons next to the contextual menu entries. The .desktop file is pretty-much self-explanatory. The scripts generate backup files before they change anything, so if it goes wrong you can get the old file back. They also work on multiple selections. The only fly in the ointment is that you have to refresh Konqueror's view to see the rotated thumbnails.
This is a very powerful technique that could be used for all kinds of things. |
|
Back to top |
|
|
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Sat Mar 22, 2003 3:18 pm Post subject: |
|
|
A quick tip: The latest version of Kuickshow (0.8.5), which comes with KDE 3.1.0 has a feature to automatically re-orientate jpegs from digital cameras if the camera has written the orientation information into the file. That means, if you rotate your jpegs using the tip above, Kuickshow will rotate them again when it displays them.
One answer (for now) is to find your ~/.kde/share/config/kuickshowrc file and change the line that says "AutoRotation=true" to "AutoRotation=false".
A better solution would be to rewrite the orientation information in the jpeg file when it is rotated. If anyone knows how to do this, please shout up!
(An even better solution would be if every app in the world understood the orientation information so you'd never bother rotating the originals in the first place...)
(Keywords: kuickshow rotate rotated autorotate autorotation orientation) |
|
Back to top |
|
|
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Fri May 02, 2003 9:54 pm Post subject: |
|
|
iangoldby wrote: | A better solution would be to rewrite the orientation information in the jpeg file when it is rotated. If anyone knows how to do this, please shout up! | Well, jhead version 2.0 will automatically rotate jpeg files according to the orientation in the Exif header.
It's very easy to install even though it's not yet in Portage. Just go into /usr/portage/media-gfx/jhead, make a copy of jhead-1.9.ebuild called jhead-2.0.ebuild, and emerge with ACCEPT_KEYWORDS="~x86". That's it. You don't need to edit the ebuild file to get the new version. |
|
Back to top |
|
|
daen1543 Tux's lil' helper
Joined: 15 Feb 2003 Posts: 85 Location: Berkeley, CA, USA
|
Posted: Mon May 19, 2003 9:54 pm Post subject: Thanks a lot! |
|
|
iangoldby, thanks for telling us about jhead-2.0! It is really fantastic that I can now auto-rotate files from my digicam! I just got a Canon S45 for a birthday present, and still cannot get over the excitement!
I think this is one of many areas where Linux clearly outdoes Windows: quickly creating very flexible scripts that use command-line utilities. I love you, Linux!
Quote: | It's very easy to install even though it's not yet in Portage. Just go into /usr/portage/media-gfx/jhead, make a copy of jhead-1.9.ebuild called jhead-2.0.ebuild, and emerge with ACCEPT_KEYWORDS="~x86". That's it. You don't need to edit the ebuild file to get the new version. |
BTW, recently there was quite a bit of heated discussion on these forums regarding the right (tm) way of managing your additional ebuilds. It seems that uncommenting this line in /etc/make.conf - PORTDIR_OVERLAY=/usr/local/portage, making the directory /usr/local/portage, and copying the renamed ebuild into /usr/local/portage/media-gfx/jhead/ is better. This way the ebuild will survive emerge sync, and you'll be able to uninstall it. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|