I wanted to crop out a specific rectangle in a few dozen scanned documents with ImageMagick like this:
convert -crop 1600x1880+100+420 image.nrm.png cropped.png
Scanning often results in a tiny skew, which would lead to a slightly different rectangle location on every image. It seems that a common preprocessing step when doing OCR is to automatically correct this skew. The Python toolset ocropy ((https://github.com/tmbdev/ocropy)) for example contains a tool to do this: ./ocropus-nlbin image.jpg creates the file image.nrm.png which is optimized for OTR and has corrected skew.


I just wanted to include an SVG file into a LaTeX Beamer presentation and I found the following articles very useful: * LaTeX and Inkscape * includesvg Apparently, Inkscape has a built in feature that allows you to write LaTeX-Code in Inkscape, export the generated SVG image as PDF and then even reimport this into LaTeX documents. Awesome!


Everyone who tried to get isolate compiled tex-code in an svg knows that this is kind of complicated if you try to do it by hand and via manual picture editing. So it sounds convenient that there exists a software that inputs Tex-Code in a software like Inscape ... and so it is! After running into a lot of 32 / 64 bit problems and some weird dll-issues when I had ImageMagick or GraphicsMagick installed I finally got the following to work (assuming that you have Miktex installed): * Inkscape 0.46 (not motivated to install it in the current version and it now runs though) * Download and Install pstoedit (be sure to install it without this Magick-Integration and put the folder of the executable in your path). * Download and Install textext. For those who are interested (i.e. myself, when I try to set it up on someone else's computer), here are the details. For faster debugging I used and edited the textext.py-File in the Inkscape Extension Folder:
Func SendF($str)
$clip = ClipGet()
ClipPut($str)
Send("^v")
ClipPut($clip)
EndFunc

Run('PATHTO046\inkscape.exe')
WinWaitActive('New document')
Send('^o')
WinWaitActive('Select file')
SendF('PATHTO\test.svg')
Send('{ENTER}')
WinWaitActive('test.svg')
Send('!c{DOWN 8}{ENTER}')
WinWaitActive('TeX Text')
SendF('$\alpha\leq\beta$')
Send('!o')
to finally get that it calls something like
pstoedit -f plot-svg tmp.pdf test.svg -dt -ssp -psarg -r9600x9600
which results in the errors I then tracked down to the problems with CORE_RL_Magick++_.dll. Links that helped me: * http://www.calcmaster.net/personal_projects/pdf2svg/ * http://pav.iki.fi/software/textext/ * http://www.pstoedit.net/