convert
convert file.jpg file.gif convert file.tiff file.jpgThe command
convert
can convert between several formats and has a lot of options, see man convert
convert -resize 50% file.jpg file_small.jpg convert -resize 200x200 file.jpg file_small.jpg # ratio will be kept convert -resize 1024x768! file.jpg file_desktop.jpg # ! = force the new size
convert -rotate 90 file.jpg file_new.jpg
dos2unix
and unix2dos
dos2unix win.txt linux.txt mac2unix mac.txt linux.txt unix2dos linux.txt win_mac.txt
iconv
to convert a text file iconv --from-code=UTF-8 --to-code=ISO-8859-1 text_in_utf-8.txt > text_in_iso-8859-1.txt
ps2pdf file.ps ps2pdf -sPAPERSIZE=a4 -dOptimize=true -dEmbedAllFonts=true file.ps pstoedit file.ps file.pdf
epstopdf file.eps pstoedit file.eps file.pdf
ps2eps file.ps
ps2ps file.ps new.ps eps2eps file.eps new.eps ps2ps2 file.[ps|eps|pdf] new.ps # converts to PS level 2
ps2ascii file.ps file.txt
gs -r300 -dNOPAUSE -dUseCropBox -dBATCH -sDEVICE=pngalpha -sOutputFile=file.png file.ps # r300 = resolution of 300 dpi
gs -r300 -dNOPAUSE -dUseCropBox -dBATCH -sDEVICE=jpeg -sOutputFile=file.jpg file.ps # r300 = resolution of 300 dpi
convert -colorspace rgb file.eps file.png
module load ncl
mv mygribfile mygribfile.grb
ncl_convert2nc mygribfile.grbThe resulting NETCDF file will be mygribfile.nc
pdftops
to convert PDF to PS pdftops file.pdfNote:
pdf2ps
does also convert PDF to PS, but normally the result is worse.
pdftotext file.pdf # or use ps2ascii pdftops file.pdf ps2ascii file.ps file.txt
pdftoppm file.pdf imageConvert page 2 (
-f 2
) to page 5 (-l 5
) with a resoltion of 300 dpi (-r 300
) to five PPM image files pdftoppm -f 2 -l 5 -r 300 file.pdf image
pdfimages file.pdf image pdfimages -j file.pdf image # write images if possible as JPEG files
abiword oowriter
pdfedit
to edit PDF Files pdfedit file.pdf
pdfunite file1.pdf file2.pdf file-new.pdf pdfjoin file1.pdf file2.pdf # alternative
qpdf --split-pages file.pdf %d-out.pdf
qpdf input.pdf --pages . 1-10 -- output.pdf pdftops input.pdf - | psselect -p22-36 | ps2pdf - output_p22-p36.pdf
pdfimages -j file.pdf image
pdf90 file.pdf
pdfnup --nup 2x1 file.pdf # 2 pages side by side pdfnup --nup 2x2 file.pdf # 4 pages on one page
epstopdf matlab_plot.eps convert -density 100 matlab_plot.pdf matlab_plot.png
pstoedit -pta matlab_plot.eps matlab_plot.emfThe crucial option is
-pta
, which fixes the ugly looking font when you directly import the eps file into openofffice (-pta
sets correct inter-letter spacing). epstopdf matlab_plot.eps pstoedit -pta matlab_plot.pdf matlab_plot.emf
tar xfv file.tar | zip file.zip "-@" tar xfvz file.tar.gz | zip file.zip "-@"
xls2csv -x file.xls -c file.cvs -a UTF-8
abiword --to=txt file.doc
man convert
): convert -delay 30 -loop 0 *.png animated.gif convert -delay 30 -loop 0 *.gif animated.gif
-depth 8
mogrify -format png -depth 8 -alpha off -density 600 -resample 150 *.eps
mogrify -format png -depth 8 -quality 100 *.jpg
man mencoder
) mencoder mf://*.jpg -mf fps=5 -ovc lavc -o output_mpeg4.avi mencoder mf://*.png -mf fps=5 -ovc lavc -o output_mpeg4.avi
mencoder mf://*.png -mf fps=5 -ovc xvid -xvidencopts fixed_quant=4 -o output_xvid.avi
mencoder mf://*.png -mf fps=5 -o /dev/null -ovc x264 -x264encopts pass=1:turbo:bitrate=1600:bframes=1:me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 mencoder mf://*.png -mf fps=5 -o output_x264.avi -ovc x264 -x264encopts pass=2:turbo:bitrate=1600:bframes=1:me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300
mencoder
the file should not be too large. 1000x1000 is still fine
ffmpeg -i output_mpeg4.avi -f mov -vcodec qtrle output.mov
convert animation.gif animation%02d.pngNow create out of the png files a MPEG4 movie
mencoder mf://*.png -mf fps=5 -ovc lavc -o output_mpeg4.avi
ffmpeg -i myvideo.flv -f avi -vcodec mpeg4 myvideo_mpeg4.avi
-b
lame -b 320 file.wav file.mp3
-q
: oggenc -q 8 file.wav
sox
sox file.mp3 file.ogg sox file.ogg file.mp3
mplayer
. Mplayer can convert every file format, which he can play, to .wav mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader:file=output.wav input.xxx
for f in *.wav; do lame -b 320 "$f" "${f%.wav}.mp3"; done for f in *.flac; do flac -cd "$f" | lame -b 320 - "${f%.flac}.mp3"; done for f in *.ogg; do sox "$f" "${f%.ogg}.mp3"; done for f in *.ogg; do oggdec -o - "$f" | lame -b 256 - "${f%.ogg}.mp3"; done for f in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$f" && lame -b 256 audiodump.wav -o "${f%.wma}.mp3"; done; rm -f audiodump.wav
for f in *.mp4; do ffmpeg -i "$f" -vn -ar 44100 -ac 2 -ab 320k -f mp3 "${f%.mp4}.mp3"; done
for f in *.mkv; do ffmpeg -i "$f" -vn -ar 44100 -ac 2 -ab 320k -f mp3 "${f%.mkv}.mp3"; done