View previous topic :: View next topic |
Author |
Message |
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Mon Jun 03, 2002 10:09 pm Post subject: Adding to Konqueror contextual menu (right click) |
|
|
Is there a simple way of adding something to Konqueror's contextual menu that appears when I right-click on a file?
I'd like to add a menu item to run jpegtrans -progressive -rotate 90 or similar commands on jpeg files that I right-click on.
If this can't be achieved easily, is it something that could be done as a plugin?
Ta
Ian |
|
Back to top |
|
|
mksoft l33t
Joined: 28 May 2002 Posts: 844
|
Posted: Wed Jun 05, 2002 3:55 pm Post subject: |
|
|
Haven't tried it, but you can
Right click a jpeg image
Select Edit File Type
Under Application Preference Order click Add
Type the command you wish to run
OK everything
Then right click and try it.
Something along this lines should work. _________________ There's someone in my head but it's not me - Pink Floyd |
|
Back to top |
|
|
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Wed Jun 05, 2002 7:12 pm Post subject: |
|
|
Yay! I tried this before posting my query and it didn't work. But I've finally discovered the problem was that I had failed to put quotes around $1 - the file name - and in my test case, the file name had spaces in. Anyway, here's the script for anyone else who is interested:
Code: | #!/bin/sh
mv "$1" "$1~"
jpegtran -optimise -progressive -rotate 270 -trim -copy all -outfile "$1" "$1~" |
For those who've not come across jpegtran before, the above does some optimisation of the image, changes it to progressive JPEG (I can't see any reason why anyone would want non-progressive JPEGs now that they are supported almost universally and since they are slightly smaller and load faster), rotates it by 90 degrees anticlockwise, and ensures that marker information inserted by digital cameras etc (recording things like exposure mode, shutter speed, etc) are preserved. jpegtran does lossless transformations, so you don't lose any picture quality by doing this, unlike loading into a graphics package, rotating, and resaving.
Make sure the execute permissions on the script file are set. When adding the script to the Application Preference Order of the Jpeg file type, it doesn't matter if 'Run in terminal' is selected or not, but if it isn't you don't get any feedback that the process is running/finished.
Ian |
|
Back to top |
|
|
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
Posted: Wed Jun 05, 2002 8:15 pm Post subject: Here's another one |
|
|
Here's one to display the extra data inserted into jpeg files by many digital cameras:
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 |
In fact the until-done loop seems to be unnecessary because KDE launches a separate process for each file selected, but it seemed neater to do it this way.
Ian |
|
Back to top |
|
|
Ian Goldby Guru
Joined: 18 May 2002 Posts: 539 Location: (Inactive member)
|
|
Back to top |
|
|
|