Any method to compress all images inside any document?

I tried to write a macro with base or a plugin called pixcompress, but no luck, how to compress all images and convert to JPG or PNG, and play with their properties without modify LibreOffice variables?

edit1: time ago I pasted 100 images of 100 kb each image, but for some reason writer size was 1GB, no sure why.

Version: 25.2.2.2 (X86_64) / LibreOffice Community
Build ID: 7370d4be9e3cf6031a51beef54ff3bda878e3fac
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: es-PE (es_PE); UI: en-US
Calc: threaded

with base?
.
If base means the database component of LibreOffice Base, things will heavily depend on the database you use… So more data needed.
.
If you wish to use BASIC as programming language you can access components of LibreOffice-files. But the question is: How to do the conversions/compression etc. Self coded routines / external libraries or do you expect to find everything in LibreOffice? Maybe python with pillow is an easier approach.
.
As a starter, without the conversion look at another thread currently active on the topic of replacing images:

1 Like

Yes, was a mistake, I used macro BASIC and no BASE.

I tried to use the default LibreOffice writer to compress images, right click > compress image > change properties, playing with macros and BASIC and also DeepSeek / ChatGPT to create the BASIC macro, but no luck. Another problem is that when I try to use this method, the LibreOffice Writer’s variables change and I need to restart to factory settings again and again.

if not possible change image settings, maybe is there any solution to paste images with pre-settings? Something like paste “As character”

the topic mentionned by @Wanderer is (rather) explicit, about the principles, i.e. embedded vs linked.

this one in more about extracting the images : Move or detach images from a Writer-file to external files, only leaving link information in text file? - #7 by cwolan

:thinking:
please, be specific about the actual problem and the context :
Ask/Guide - How to use the Ask site - The Document Foundation Wiki #More_details

I mean, when I try to create a macro with help of any AI, this sometimes change variables, no idea why, but when this happened other extension stop working, then I need restart to factory settings.

which ones ?

which one ?

and again :