Differences between revisions 20 and 21
Revision 20 as of 2013-12-10 19:59:20
Size: 2258
Comment:
Revision 21 as of 2016-03-09 16:24:03
Size: 2371
Comment:
Deletions are marked like this. Additions are marked like this.
Line 105: Line 105:

== pyp replacement for sed ==
{{{
for i in *.xml;do mv $i `echo $i |pyp "p.split('_')[0]+'.xml'"`;done
}}}

Describe ImageManagement here. Keywords: Image processing, resize images, batch process, rename files

Install tesseract OCR

apt-get install tesseract-ocr

Install imagemagic

  • This is a command line image manipulation

apt-get install imagemagick

Image resolution

identify -verbose filename.tif
  • To find out what is common resolution for images in the folder:

for i in *.tif; do identify -verbose $i|grep Resolution; done

Resize and rename the pictures

for i in *.jpg;do convert -resize 450x $i `echo $i| sed 's/.jpg/_resized.jpg/g'`;done 

Ocr whole folder

for i in *.tif; do tesseract $i $i; done

Zip whole folder

for i in *; do zip -r $i.zip $i; done

for i in 2006*; do zip -r ../../nas01/Data-Archive/Documents-Archive-2006/$i.zip ./$i; done
  • Identify file resolution

Rename Part of File

for i in *; do mv "$i" `echo $i |sed 's/oldpattern/newpattern/g'`; done

for i in 02436454_*; do ted --printToFile $i test.ps; lpr test.ps; done

or openoffice -p filename

execute command in folder

cd ../;
mainfolder=`pwd`
echo $mainfolder;
for i in *;
do 
if [ -d "$mainfolder/$i" ]; then 
    cd "$mainfolder/$i";
    pwd;
    epydoc --config ../archive/doc.ini;
fi
done

stop moin moin spam

to disable users I use this to quickly find the spammers:

for i in `grep usr *|sed -e 's/:[e|n].*//'`;do vi $i;done

replace text in all files

find . -type f -print0 | xargs -0 sed -i 's/Application/whatever/g'

filename renames

Get filenames basename without the extentions

ls -d *.php | sed 's/.dbf//g'

Reverse Lastname comma Firstname

In order to reverse a name in Column D:

from :
WILSON JR,BOB
to:
BOB WILSON JR

do the following in openoffice

=MID(D1,FIND(",",D1)+1,255)&" "&LEFT(D1,FIND(",",D1)-1)

Repalce or Delete first 44 charaters with blank

  • Helpfull if you are doing ls -l to list directory and then taking out all the characters before actual file name. In my case it was 44 first characters.

:%normal 44x

pyp replacement for sed

for i in *.xml;do mv $i `echo $i |pyp "p.split('_')[0]+'.xml'"`;done

MyWiki: ImageManagement (last edited 2016-03-09 16:24:03 by LukaszSzybalski)