Orthanc compression

Is there a way to setup compression for already stored images?

The problem is that image import with onfly compression is very slow (about 4-5 Mb/s) and processor expensive so I want to setup delayed compression for old images which should be executed when system isnt busy (at weekends).

Hello,

Thanks for your message. This is not currently possible, but I have just added a task on the roadmap:
https://trello.com/c/NLQN0Mr8

Sébastien-

Thanks for response. Hope my disks pace will come out after new release)

Are there any drawbacks if I compress file with zlib and then alter 'compressiontype' to 2,'compressionhash' and 'compressionsize' columns in the 'attachedfiles' table?

Are there any special parameters of zlib compression?

Do not do this: The compressed files correspond to zlib-encoded files, but they are prefixed by a 64-bit integer that contains the size of the uncompressed file. It is highly dangerous to manually modify the SQLite database.

I would rather strongly suggest you to replicate your current instance of Orthanc into a fresh instance of Orthanc in which storage compression is disabled:
https://orthanc.chu.ulg.ac.be/book/users/replication.html (section “Generic replication”)

You might also be interested in the following maintenance tool that can decompress the files that are stored in the “OrthancStorage” directory:
https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/Tools/RecoverCompressedFile.cpp

Sébastien-

This feature is now part of the Orthanc mainline [1], and will be included in forthcoming release 0.9.5.

Each attachment is now associated with 3 additional URIs: “compress” (to compress using zlib), “uncompress”, and “is-compressed” (will return “0” or “1” depending on whether the attachment is compressed).

Sample integration tests are also available to illustrate this behavior (in “test_compression”) [2].

HTH,
Sébastien-

[1] https://bitbucket.org/sjodogne/orthanc/commits/8ca0e89798b2a41dfb53fb1b27a38fe2529a2d8e
[2] https://bitbucket.org/sjodogne/orthanc-tests/src/7c08e542db231bcf7163069c655121780bf5bb30/Tests/Tests.py?at=default&fileviewer=file-view-default#Tests.py-2367