Using a simple command line command it is very simple to rotate any number of images using the exif data (hopefully) contained in the image. Most cameras will save the exif data and include the camera rotation when the photograph was taken.
sudo apt-get install jhead
then when we run the following command in the folder it will losslessly rotate the photographs that need it.
jhead -autorot *
Job done :]
I no longer use Ubuntu, Old articles will remain but from 2013/11 everything will be related to Debian.
Showing posts with label image. Show all posts
Showing posts with label image. Show all posts
Friday, 24 July 2009
Monday, 15 June 2009
How to read 20 magazines for free.
You will need Firefox and an addon called User agent Switcher and configure it with an iPhone setting :
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419 (United States)
You can then visit http://zinio.com/iphone/ and read 20 magazines each month for free.
It gets better though, it is very simple to download these pages onto your computer using Linux, aren't you glad you dumped windows ;)
We now need the URL to the image so "copy image location" from the right click menu then using this command:
curl -O -A "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3" INSERTURL
Replace INSERTURL with the copied link you got to page 1, then delete back to the underscore and append [1-300].jpg this is a range option to grab pages 1 to 300 and can be adjusted, so the final command will look like this:
curl -O -A "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3" http://imgs.zinio.com/iphone/issues/416078746/[1-300].jpg
The files will need to be renamed, as sadly they won't sort correctly if you are going to do the next step of combining them into a single pdf. We need the jpgs numbering from 001.jpg so they order correctly. this can be achieved in a variety of ways, using Thunar rename to insert the necessary 0's in two stages is one simple way, insert 00 at position 10 for number 1-9, and insert 0 into postion 10 for pages 10-99. it can also be scripted in a couple of steps with :
for i in `seq 1 9`; do mv *_$i.jpg 00$i.jpg ;done
for i in `seq 10 99`; do mv *_$i.jpg 0$i.jpg ;done
This could of course be scripted into one single command using a bash script.
Then we can simply issue the command:
convert *.jpg magazine.pdf
Thats it, you now have a local copy of the magazine in a handy PDF format relatively simply, it lokos more complex than it really is once you get your head around it.
Friday, 12 September 2008
Recover Photographs From a Memory Card
Thursday, 14 August 2008
Use convert to add a border to multiple images in the command line
Ok, so you you have taken a bunch of photos with your new camera and what do you know, some of them are half decent. I use this after I have copied photo's I want to print or photo's that I am sending to flickr or deviant art to a seperate folder as it really adds a finishing touch, I copy them to a seperate location so I know exactly which ones I am printing/uploading and don't omit any.
Now you could easily do this in The Gimp, load each image and enlarge the canvas followed by a fill and then resave the image. This is linux though and we can do things a heap simpler than that!
First install Imagemagick:
sudo apt-get install imagemagick
Or install it via Synaptic or your package manager.
Then use this simple script,
be aware that you should operate on copies as this does overwrite the original, as noted above I only do this on photo's I have copied for printing/uploading.
for img in `ls *.jpg`
do
convert -bordercolor white -border 50x50 $img $img
done
Easiest to pop it all into a bash script, or just close it up separating the commands with semicolons into a one liner eg.
for img in `ls *.jpg` ; do ; convert -bordercolor white -border 50x50 $img $img ; done
If your camera uses a different extension then adjust the .jpg accordingly.
Adjust "50x50" to whatever you feel adds a nicely sized border, and feel free to change the border colour (black for instance). If you want to get creative stack up the converts to add a thin black border before a larger white border or whatever you fancy.
Now you could easily do this in The Gimp, load each image and enlarge the canvas followed by a fill and then resave the image. This is linux though and we can do things a heap simpler than that!
First install Imagemagick:
sudo apt-get install imagemagick
Or install it via Synaptic or your package manager.
Then use this simple script,
be aware that you should operate on copies as this does overwrite the original, as noted above I only do this on photo's I have copied for printing/uploading.
for img in `ls *.jpg`
do
convert -bordercolor white -border 50x50 $img $img
done
Easiest to pop it all into a bash script, or just close it up separating the commands with semicolons into a one liner eg.
for img in `ls *.jpg` ; do ; convert -bordercolor white -border 50x50 $img $img ; done
If your camera uses a different extension then adjust the .jpg accordingly.
Adjust "50x50" to whatever you feel adds a nicely sized border, and feel free to change the border colour (black for instance). If you want to get creative stack up the converts to add a thin black border before a larger white border or whatever you fancy.
Tags:
bash,
convert,
filehandling,
image,
imagemagick,
jpg,
linux,
photograph,
script
Subscribe to:
Posts (Atom)