Compress Image with macro, librebase

As a quick contribution & ThankYou! for all the code I have found and used from the community here:

I was searching for a method for image compression within a librebase macro … pretty much the closest i got was :

So, I solved this (at least for my usage) with Python (outline):

a)start by making sure Python is installed for LO, and might-as-well get Pillow/PIL module at same time…
b) work out the necessary Python code (e.g get_dependent_modules (pillow), compress & copy file-list…) for PYTHON.py
c) make 2 macros;
macro1

  • check OS type
  • select the images > get filelist as fList:
  • create PYTHON.py with hard-coded file-paths, using FreeFile# to write fList: into those file-paths, (saved @ location: = user/PYTHON.py)
  • call macro2(PYTHON.py)

macro2
-… execute_python @ location: user/()

There are some obvious additional benefits to this approach…

LoveYouLibre!
(and thank you)