Home About Meetings FOSS

April 9 2019 PyPi, DigiKam, GIMP, pdfjam and LyX Meet

Posted on 2019-04-12 21:55:36 +0000 by John

Bernard demonstrated the Python Package Index for which anyone can write packages. He showed how you could set it up and then how you could download a package to a virtual environment with:

python3 -m venv ~/v5

where v5 is a virtual environment in userspace. To activate that virtual environment, you enter

source ~/5/bin/activate

You can download a package such as:

pip install skipole-bernieski

and, when you have finished experimenting with it, enter

source ~/5/bin/deactivate

to deactivate the virtual environment.

It works best with pure Python packages and is a very nice way of letting people get hold of your software and trying it out.

John then shared how he downloaded images from his smartphone using digiKam, switching to the standalone part of digiKam, ShowFoto, which manipulates images. Drawing on David’s legendary presentation on Digital Photography, he demonstrated Free rotation and Aspect ratio crop to correct a tilt in the image and to crop to a standard size. Among the other options in ShowFoto are Perspective adjustment which allows you to straighten up objects inside images.

He then went on to demonstrate work he is doing scanning and tidying up old documents which often have rust marks from disintegrated staples or annotations by a former owner. Using the Tools->Paint->Clone option in GIMP and changing the View to 400%, he selects a clean area close to an undesired mark and clones the area to replace the mark. He has found this a better way to match the colour of old paper than trying to use a Fill to cover the mark.

He then demonstrated using Aspect ratio crop in ShowFoto to split a two page scan into two separate pages, pointing out that, if the page needs Free rotation, Aspect ratio crop ensures that the ratio of the cropped page will be the same. He then sets up a LibreOffice template with the same size and aspect ratio as the original document and imports the images but does not save the LibreOffice document; he exports to PDF creating a continuous PDF of the pages in the original document.

Finally, he demonstrated pdfjam, a suite of command line programs for manipulating PDFs. Following pdfjam with a list of PDFs concatenates them into a single PDF. However, there are a great many options and another which John has used is:

pdfjam WWI_Roll_of_Honour_A5.pdf '44,1,2,43,42,3,4,41,40,5,6,39,38,7,8,37,36,9,10,35,34,11,12,33,32,

13,14,31,30,15,16,29,28,17,18,27,26,19,20,25,24,21,22,23' --landscape --nup 2x1

which takes the portrait orientation PDF WWI_Roll_of_Honour_A5.pdf and creates a 22 page A4 landscape PDF with all the pages in the right order for printing out.

This led into a discussion of manipulating PDFs and long documents generally and John said that he used LyX for these tasks; though it is theoretically possible to import Word and LibreOffice documents and spreadsheets into LyX, John had generally found it was easier to save them as text or CSV and import then into LyX in that format.

LyX has a great many advantages for longer documents:

LyX is a very small program which simply passes scripts to other programs to execute; so you may find yourself downloading up to 0.5GB of other programs when you install LyX. As Linus has observed, LyX is one of the few programs which still adheres to the Unix philosophy of using what exists and not recreating things which already exist. About the only thing completely original is Advanced Search and Replace which allows you to search for and replace an expression with a particular style, for example, in italics only.

There are various papers on LyX available on John’s website. He often consults them himself because writing the papers helps him to keep track of all the different features he has learned and used over the years.