Image Attachment Compression-Odoo Apps

1-Odoo image compression enables compressing images stored as attachments for any model.
2- Compress images based on a set of rules
3- Flexible rules for compression:
By model where images are uploaded.
By mimetype; a regular expression that allows to filter what type of images to compress.
By size; it allows to compress images having a bigger size than the configured size Compress attachments newer or older than specific dates.

Image Attachment Compression

Checkout below step-by-step guide:

Process:

-Configuration: Setup a compression rule

  1. Select the models where image attachments to be compressed.
1

 2.Set the source format and destination format (NOTE: The source format should be a regular expression of mimetypes e.g. images/.*bmp.*).

  3.Set the optional minimum size of attachment.

4.Set the optional newer than/older than days to compress.

4

5.Set the quality of the compressed image (value between 0 and 100 where the larger the value, the higher the compression but the lower the quality).

5

 6.In Odoo, storage is done by content.

Thus, if the same image was uploaded twice, it will be saved on the disk once.

Thus, there is an option to match all similar images, compress them and delete the uncompressed images.

To activate this feature, check the “Replace All”

7.If you want the scheduled action to run this compression rule daily, keep it active.

7

Scheduled Action:

  1. Upon installing the Odoo image compression module, a daily scheduled action “Run attachments compression rules” is added automatically.

How it works:

Add images: Add some image attachments in the models.
In the following example, I selected the employee model in my compression rule. So, I am adding a BMP image there.

Run the compression rule: Go to the corresponding compression rule and run it. The Images satisfying these rules should be compressed.
The system will show a pop up with the details of the compression:
compressed images and total size reduction

Check results: Go back to the model where the image was uploaded and verify the results.
Download the image and check the size reduction.

File Store: Notice that upon running a compression rule or when the scheduled action runs them,
the size of the filestore is reduced if Replace All was checked.