Image Size in Bytes

X

xlfdic

Hello,

I have a large Word file with about 300 images in it.

I have visited MS and MVP pages any tried every trick in the book to
reduce the size of it,but with not much luck.

If I knew which images were bloating the most I could address those
directly.

Does anyone have a bit of quick and dirty code that will run through
the doc and print a list of images and their size in bytes, and which
page they are on.

(I'm not a VBA techie, but I can follow the logic of simple code.)

Thanks.

Peter
Cardiff
Wales
UK
(Overcast sky, grey and a bit chilly. Its Summer in the UK!)
 
P

Peter Noneley

' I had a go at a macro myself.
' got this far and am now stumped.
' All help appreciated.



Sub Macro2()
'
' Macro2 Macro
' Macro recorded 18/07/2008
'
For Each s In ActiveDocument.Shapes
s.Select

' I can see its name, actually a number such as 1 2 3 etc.
' but not for shapes "In Line With Text"
MsgBox Selection.ShapeRange.Name

' I can see the type, but the only number I get is 13.
' I think 13 means msoPicture
MsgBox Selection.ShapeRange.Type

' I want to do this next, but it does not exist.
MsgBox Selection.ShapeRange.SizeInBytes
Next s

End Sub


'How can I

' (1) Select all shapes, whether they are In line, floating or in a
Canvas?
' (2) Find out what type they are such as Picture, JPG, GIF, BMP etc.
' (3) Find out its size in bytes.

'Thanks

'Peter
 
M

macropod

Hi Peter,

Whilst you can work through the shapes collection and the inlineshapes collection (hint), that can only return you the image
dimensions (remember to take any scaling into account). However, that won't tell you how many bytes the image requires. Pictures in
Word are stored in jpeg or png format, and the amount of storage space such images require depen not only the physical dimensions
but also on the amount of detail and the level of compression used.

If you want to find out which images require the most storage space, the easiest way is to:
.. re-size all the images to 100% of their original size (Format|Picture|Size), then
.. save the document as a Web Page.

The pictures will be given a names like 'image001.jpg' etc and will now be in a sub-folder with a name based on the name of the
document (eg if the document was named MyFile.doc, the folder will be named MyFile_files), in the folder in which the document was
saved. If you sort the files in that folder by size, you'll soon see which files are the largest. Resize these files with a graphics
app then replace the originals in your document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top