Page 1 of 1

Deleting unused images from odp file

Posted: Tue Jan 22, 2008 11:51 am
by firatkucuk
hi,
i renamed oo impress .odp file to .zip file and extract to a directory.
Then i noticed lots of unused pictures (that i deleted from presentation before) in the directory.
Some of these pictures has no active reference.

How can i delete this files via using impress?

Re: deleting unused images from odp file

Posted: Tue Jan 22, 2008 2:36 pm
by TerryE
Hint on opening ODF files under XP you can right click and use Open With to select WinZIP (or whatever your installed zip utility is) to open them directly without having to rename the file.

Find one of the "deleted" images and note its name. Then open the content.xml file and search for this name. If you get a hit then it is still referenced. Looking at the adjacent XML should give you a clue.

I thought that it might be to do with the UNDO stack, but Impress does not preserve this over a save.

Re: deleting unused images from odp file

Posted: Tue Jan 22, 2008 3:03 pm
by firatkucuk
i didn't find the file name in the content.xml. Shouldn't impress delete the file if it has no reference?

Re: deleting unused images from odp file

Posted: Tue Jan 22, 2008 3:16 pm
by firatkucuk
i found it in the styles.xml

<draw:fill-image draw:name="sablon" xlink:href="Pictures/1000000000000640000004B01F663B31.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>

there is no reference in content.xml.

Re: deleting unused images from odp file

Posted: Tue Jan 22, 2008 4:24 pm
by acknak
So it looks like the image is used in a style definition, possibly as a background image. That style may not be in use, but it could be used, so the image is kept in the presentation file. To completely "release" the image, you need to find that style and change it to use a different background.

I think I have seen a way to delete all unused styles but I can't remember where.

Re: deleting unused images from odp file

Posted: Wed Jan 23, 2008 12:44 am
by TerryE
You will see the expand symbol to reveal style at the middle right hand edge of the Impress viewing pane to the right of the scrollbar. Clicking on this will expose the Styles toolbar. You can use the filter to select various views, such as only applied styles. You right click to delete any custom style, but its first a good idea to see if its applied, because deleting applied styles could mess up your layout.

Re: deleting unused images from odp file

Posted: Wed Jan 23, 2008 12:41 pm
by micha137
Hi,
I have a similar annoyance with an unused background pattern. Searching the styles part gave me some 2-3 references, but the pattern is definitely not used. Additionally there is no style among the applied styles which uses it. I suspect the background pattern came with a graphics object(not using the pattern) which I created in draw and inserted by copy and paste.
In Impress however, the pattern of size 14kB seems to lead its own gypsy life without beeing anchored to a definite slide. Sometimes, deleting the slide with the graphics that probably imported this "illegal alien" removed the ghost pattern, sometimes it was only removed after deleting some more(almost all) slides. But reintroducing another slide, that had nothing to do with the graphics, did reintroduce the ghost pattern again. So I can't pinpoint it to a specific object or even slide.
Up to now I decided I have to live with this, since It is really a minor issue, but I can't help being uncomfortable about this and consider this as a potential security hazard.
Perhaps the ghost was introduced erroneously while using an old dev-snapshot and is not cought by the current cleanup routines? All my files containing the "ghost" were created in a certain time span (some moths agon still in my old windows days).

regards micha137
happy user of ubuntu "gutsy"

Re: deleting unused images from odp file

Posted: Wed Jan 23, 2008 2:00 pm
by ccornell
Use this extension:
http://extensions.services.openoffice.o ... nMinimizer
The extension should strip out unused images as well as speaker notes etc (if you tell it to of course). Works pretty good for me :)

Re: deleting unused images from odp file

Posted: Wed Jan 23, 2008 2:30 pm
by micha137
Hi,

the post made me check again in more detail.
In my case the ghost image indeed comes with pasted draw objects from an old (faulty) oo-draw version. The ghost is gone when I copy the grouped drawing to the a current oo-draw page, delete the group in impress and plainly reinsert it again per copy and paste from the current draw page. I have to do it with all draw objects to get rid of the ghost.
The fact that I couldn't pinpoint the location of the ghost before was due to the fact, that I had multiple draw objects inserted (some of them small so I wasn't aware of them) and each of them independently caused reappearance of the ghost-pattern.

I did not succeed in my attempts to do something to the styles directly. Indeed in my case the hatching "red_crossed_45_deg" (even though never used) referred to the bitmap "Orange"(the "ghost-image" even though there is a valid "Orange" in the standard settings) without using it and without any apparent possibility to remove the nonsense "Orange" filling via editing the hatching-style.

So it was due to a past faulty oo-draw version or installation in my case and seems to be no problem anymore with recent OO-Impress/Draw files.
Maybe you could check, whether any imported objects from older OO-components carry the ghost-image(s) in your case too.

regards
micha137

Re: deleting unused images from odp file

Posted: Wed Jan 23, 2008 2:43 pm
by TerryE
At least you can diagnose why you've got the baggage in the ODP file. I work with PPTs at work and Powerpoint (up to 2003) will often not bother to reclaim dead space in a file so in an extreme case where someone has taken a 20 slide deck and deleted all bar one slide the PPT is still the same size. I sometime use OOo Impress to open and save such PTTs to garbage collect this crap. I've reduced PPTs from 5Mbytes to 0.3Mbytes doing this. Bizarre and slightly off subject but there you go.

Re: deleting unused images from odp file

Posted: Wed Jan 23, 2008 4:38 pm
by acknak
The bitmap area fills seem to be in a different category. You have to specially load it into the list of bitmaps, and that list is available in the other OOo apps. That's very different from a style background image.

Perhaps if you go to the area fill bitmap list and delete it there, it will release the data from the document.