Page 1 of 1

[Solved] Smart way to change links to images ?

Posted: Wed Jun 11, 2008 9:24 pm
by kevegas
IS THERE a smart way to mass-change all the links to all my images in my presentation?

I've tried to move a presentation to a flash-drive, then discovered all images were linked and not actually embedded. I must change
the links for 80+ images. There surely must be a smarter way to do this.

Any help would be greatly appreciated!

Re: smart way to change links to images ?

Posted: Thu Jun 12, 2008 4:04 pm
by RGB
Edit -> links -> break link (you must select them first)

Re: smart way to change links to images ?

Posted: Thu Jun 12, 2008 4:30 pm
by Villeroy
As far as I know from Writer with linked pictures, all paths are relative (./subdir/picture1.png) even if they are shown as absolute paths (file:///path/subdir/picture1.png). So when I move file:///path/document.odt together with ./subdir/, the linked picture will be located in file:///new_path/subdir/picture1.png
Give a try.

Re: smart way to change links to images ?

Posted: Thu Jun 12, 2008 6:18 pm
by Phil
Villeroy is indeed right, so I hope this solves your problem.

If not, you may try the following:
Rename the .odp file to .zip and open it as ZIP archive using some archiver tool like 7-Zip (in fact all the OpenOffice files are ZIP files with various files that contain the document structure, images etc.).

Now extract the file content.xml from the ZIP archive and open it using some text editor (ideally one that does syntax highlighting, e.g. Notepad++).

For each link, you will find an entry like this in the file:

Code: Select all

<draw:image xlink:href="../Image.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad">
Now you can change the paths of all images using Find & Replace.
Finally, update content.xml in the ZIP archive with the changed version and rename the file back to .odp.

I admit it's not a straightforward way, but it works. :mrgreen:

BR, phil

Re: smart way to change links to images ?

Posted: Fri Jun 13, 2008 5:27 pm
by micha137
Hi there,
I frequently had the same problem when porting presentations between machines with different directory structures, when accidentally absolute paths were introduced.
For me directly editing the content.xml file seemed the best option.
You don't have to rename the files to *.zip. You can explicitly open them with any archiver.(In ubuntu e.g. I just select "Open With" "XArchiver"),
edit the files(e.g. with "mousepad" in ubuntu), correct the paths per find and replace and put content.xml back into the archive.

I would not recommend breaking the links since this will greatly increase filesize. You won't be able to undo this without a lot of work and are stuck with the big files. I prefer keeping backups after editing my presentations on a regular basis and with embedded media this would mean storing masses of redundant data.
Breaking the links might be ok if you are just dealing with very few presentations containing small media files, but in my opinion it is not an elegant solution.

In fact I miss a function in impress to outsource media files to a specified directory.

regards
micha137

Re: smart way to change links to images ?

Posted: Fri Jun 13, 2008 6:46 pm
by acknak
I would not recommend breaking the links since this will greatly increase filesize. You won't be able to undo this without a lot of work and are stuck with the big files.
You have a good point, but I don't understand how it would make that a big a difference. How big does a file have to be before it's a problem? I remember when a 1M image was "too big". Now, a 50M file is really not a problem. A 50M presentation file can hold a lot of images.

Also, if you have the images linked in, the presentation is no use without the images so you have just as much file storage to move around, but now you have to worry about moving several (or many) files, and keeping the correct relative locations (or editing the links).

I think my presentation file would have to be >>50Mb before it would be worth all that hassle. At 700-1000k of image per slide, that's still over 50 slides.

Further, many people do not understand the effect of image resolution in a presentation. There is no advantage to include images that exceed 1000 pixels across, but people still just copy and paste their camera images that are 2-3 times more (5-10 times the file size) into their presentations, resulting in a 100 megabyte presentation that has only 20 slides.

One handy tool that can help in that case is the Sun Presentation Minimizer. It will analyze a presentation and scale the images to minimize the file size without sacrificing image quality.

Re: smart way to change links to images ?

Posted: Fri Jun 13, 2008 7:14 pm
by kevegas
THANK YOU, one and all. I had the most luck with Phil's suggestion and the work was pretty quick. Good tip also on the size-of-images as I can now reduce the overall file size. My first post to this forum -- GREAT and timely responses. THX ! - kevegas