Serverside transaction image recompression

It is common to scan and attach invoices/receipts etc to transaction records in MoneyWorks to avoid having to keep paper copies.

Unfortunately, scanners and cameras tend to create files are that are much much bigger than is necessary for a reasonable record of the document. This can result in the Pictures folder for an accounts document becoming very large, not to mention every full backup.

MoneyWorks Datacentre 8.1.9 and later can take advantage of 3rd party software (if installed) to recompress scanned images in uploaded JPEG and PDF files to more reasonable DPI and quality level—still readable, but not excessively large. The software necessary for recompression is not installed with MoneyWorks Datacentre, but you can install it yourself and MoneyWorks Datacentre will detect it and use it if present.

On Mac, you can install jpegoptim and ghostscript using homebrew. These are expected to be installed at /usr/local/bin/jpegoptim and /usr/local/bin/gs respectively. If these files are present, MoneyWorks Datacentre will execute them to optimise uploaded JPEG and PDF transaction images.

In MoneyWork v9.1 and later, the Apple Silicon-native paths /opt/homebrew/bin/jpegoptim and /opt/homebrew/bin/gs are used.

On Windows, jpegoptim must be installed in the MoneyWorks Datacentre directory C:\Programe Files (x86)\MoneyWorks Datacentre\jpegoptim.exe. Ghostscript 64 bit should be installed at C:\Program Files\gs\gs9.50\bin\gswin64c.exe (prior to MoneyWorks 9.1, this is the only supported gs version, but see below).

In MoneyWorks 9.1 and later, the preferred locations are gs.exe and jpegoptim.exe in the same directory that MoneyWorks Datacentre is installed in (which may be in Program Files (x86) or Program Files, depending on whether it is a new install or an upgrade from an earlier version. Since Ghostscript has the regrettable habit of changing its installation path for every version, you should create a symlink in the MoneyWorks Datacentre directory that links to the gs version you have installed.

mklink "C:\Program Files\MoneyWorks Datacentre\gs.exe" "C:\Program Files\gs\gs9.56.1\bin\gswin64c.exe"

Recompressing already-uploaded images that are Too Big

To iterate over all images in a directory and recompress them, you can run the following on the command line on the server (assuming jpegoptim and/or gs are available). It is safe to re-run this command, since already-recompressed or already sufficiently-compressed files will not be reprocessed.

moneyworks -e "optimg dir='path-to-Pictures'"


moneyworks.exe -e "optimg dir='C:\MoneyWorks Documents\MoneyWorks Custom Plug-Ins\Pictures for Acme'"

Preventing backup of Pictures

Even with appropriate compression, if you have many attached images, the size of the images may still make including them in the regular backup file undesirable.

If you want to exclude the Pictures subfolder for a particular company from the regular backup (and back up those files by other means), this can be done by placing an empty file named _EXCLUDE_FROM_BACKUP.TXT at the top level of the Pictures folder.

In Datacentre 9.1.1 and later there is also an option in the Console settings to only include Pictures folders in backups once a week, or never. This will apply to all companies on the server.

Posted in Uncategorized | Comments Off on Serverside transaction image recompression