I have a very large document and I need to resize all the images in it to 50% of their current size. Is there any easy way of doing this? Doing it manually one by one just isn't an option as it'll take too long.
Is there a built in option to do this? Is there a Macro I could use?
[Solved] Resizing All Images?
[Solved] Resizing All Images?
Last edited by Hagar Delest on Tue Aug 03, 2021 10:11 am, edited 1 time in total.
Reason: tagged solved.
Reason: tagged solved.
OpenOffice 3.1 on Windows 7
Re: Resizing All Images?
A first thought: if the images are linked, you could move them from their source directory, process them to 50% in batch mode with some suitable image processor, saving them in the source directory under the original name, and then they ought relink on opening your document. You may need to adjust their position afterwards.
Edit: Macro given in http://user.services.openoffice.org/en/ ... =20&t=1112 |
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Resizing All Images?
Thanks but the images are not linked. They are embedded. Also that macro appears to be for one manually selected image. I want to resize all images in one go and even selecting them all manually isn't an option. I am talking about a 3500 page document.
OpenOffice 3.1 on Windows 7
Re: Resizing All Images?
You have the core of the macro - the bit that does the work. What you need now is a wrapper that passes through the document, selects each image in turn and then runs that macro.
Edit: If you have programming skills in (say) BASIC, you could open the archive file that comprises your document and take out content.xml, then pass this to a new file, scanning for svg:width=" and svg:height="; when either of these tokens is found, you read in the |
Last edited by RoryOF on Fri May 06, 2011 10:42 am, edited 1 time in total.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Resizing All Images?
You have to learn the rudiments of programming. There are not macros/programs for every possible task. Writing a macro is a _non-trivial_ task and needs user input.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Resizing All Images?
Definitely back up your file before your run this.
Code: Select all
Sub ResizeAllGraphics
Dim go,g,i
go = ThisComponent.getGraphicObjects
For i = 0 to go.Count-1
g = go.getByIndex(i)
g.Height = g.Height/2
g.Width = g.Width/2
Next
End Sub
Re: Resizing All Images?
JohnV
...thanks a lot for the code snippet. It works awesome.
Swinebolt
...thanks a lot for the code snippet. It works awesome.
Swinebolt
OpenOffice 2.4 on Ubuntu 9.04