środa, 18 maja 2011

Converting files - why linux is so wonderful

I'm a linux user for 5 or 6 six years now and want to give you some glimpses on how wonderful environment it can be for daily tinkering. 

Sometimes I have to change format of some file or files. This is the moment when the power of linux can be unleashed.


There are plenty of free and commercial programs to do the conversion on Windows and you don't know which one to choose, which one can do the stuff you want for free, which is easy to use or has a good tutorial. Plenty of things to think about, but all you need to do just convert something now and the program won't be used for a very long time.
However working on linux is much easier at least in this aspect. Chance that you already have a script or program that will do what you want is huge. Most of them is named in natural convention: ps2pdf - for converting PostScript files to PDF.
If you want a manual for it, you just have to type man ps2pdf and everything will be printed in the terminal. If something is not already available, quick query in the wiki of your distribution or in the forum and you'll get complete solution in 90% of cases.
Today I had this kind of problem. I wanted to print some scanned pictures of my friend's notes, but there were 200 pages in 200 files - person who scanned them was not very crafty. Anyway, in two minutes I found the solution - little script.

# This step is only needed when the images are in png format
# you would need to do the same with jpg's
for i in *.png ; do
if [ -f "$i" ]
then
convert +compress "$i" "`basename "$i" .png`.tif"
fi
done
########
tiffcp *.tif "Images.tif" # joins all file in one
tiff2pdf -z "Images.tif" -o "Images.pdf" # converts file into pdf
rm "Images.tif" # removes old files


Using that within 5 seconds I got very handy pdf with every picture in right order.

22 komentarze:

Unknown pisze...

will follow

limbo man pisze...

very cool

SuperBro pisze...

neat drombo. check my blog out i think you like

NINE TAILS pisze...

I would certainly love to try linux sometime, you should post more about this type of stuff! :D Following! Follow me back! :)

Ketomaster pisze...

What flavour of linux you on? Using Ubuntu, but it pisses me off sometimes. I'm probably going to switch to Fedora soon.

pisze...

I for one love linux and ubuntu needs a lot of work... nice blog

R.C pisze...

I'm doing research into linux myself. Thanks for this!

Dave pisze...

really interesting article drombo, haven't made the full jump to linux yet (as my new job has me working in windows environments) but awesome to know and reference. Cheers!

Loev pisze...

Yeah, I tried linux once, but couldn't get the hang of it quite...but it seemed like it had alot of potential! Like this.

Good post! Maybe do somemore and i will try again!

mindph pisze...

I love Linux too for the might of the comandline, something Windows will never reach

Spartan094 pisze...

Pretty awesome, but I'm too far entangled in windows to ever switch to Linux. Also enjoy learning stuff, so thanks!

Mike pisze...

I'm embarrassed to say I've never used it before.

Xenototh pisze...

Can you do these kind of file changes to movies and such? You should make a guide on that, like changing wmv to avi, or the like.

BigMike pisze...

Yaaaaa i just click my photo shop icon, drag and drop the file into it when it opens, and then click file saveas... WAY easier.

13-c-a-t-s pisze...

to be fair, that's more a UNIX than than specifically Linux. I used to use HP-UX and loved the wee things, like being able to type into the terminal any date in the past or future and have it tell you the day of the week!

Jim pisze...

Never really had to convert any files, this method looks confusing though.

Anonimowy pisze...

It don't look simple, but I dunno anything about Linux

Trolske pisze...

I thought about getting Linux, but I#m not techsavy enough.

mindlessfrk pisze...

I've used it once, couldn't get used to it, still prefer mac or pc.

randomer pisze...

Yet again the power of linux shines through, it's amazing how much can be done using a few lines of bash.

drombo pisze...

@mindlessfrk
Command line requires some time to get used to. You also need a good shell - I use zsh, mostly because of auto completion of commands, directories, etc. - tremendously user-friendly feature.

Sunshine pisze...

i loooove linux! all windows users dont get why...but i dont care XD

Prześlij komentarz