when I export my large docx file using Microsoft Word 2010/13 into filtered html I discovered that png images are compressed regardless of the settings described in here Word to HTML Conversion- Loss of image quality.

Unfortunately, zipping the docx file and accessing the native images does not help me, as these images are differently numbered than the images which are created by the export dialogue.

Does any one of you have an idea how I can disable such compression.

Best regards

  • 2
    Not the answer you're looking for, but don't use Word as an HTML WYSIWYG editor. You'll get lots of overhead and possibly weird HTML code that way. What are you trying to do? If you want to share your document on the internet, you might be able to use PDF directly, since pretty much any modern browser is capable of displaying PDF documents without additional plugins. – Mario Dec 16 '16 at 7:33
  • Unfortunately, I have no other option. The document I am working with is a large docx file and I have to use the word filtered html export option. – Andy Dec 16 '16 at 7:57

You can't disable this feature in Word, but you can edit the source code of the HTML document so that it uses the original image instead of the compressed one.

If you go into the documentname-files folder which is in the same folder as the HTML file when you save it, you have two different image files for each image image: one compressed JPG image and the original PNG image. The original PNG image is used in old versions of IE (version 8 or older) which support VML and the compressed JPG image is used in almost all other browsers. Since VML is depreciated since IE9, all modern browsers use the compressed JPG-image.

However, even the latest versions Word still use VML when creating HTML documents, which does so that the original image is exported along with the HTML document, although practically no browser uses it. If you want to use it, you can edit the HTML source. To do this, you need to know what names the images have. Look in the documentname-files folder (replace documentname with whatever your file is called). Here is a screenshot of how this will look if you have one PNG image in your HTML document:

enter image description here

Here, the original PNG image is called image001.png and the compressed JPG image is called image002.jpg. Then, open the HTML document with Notepad or any other plain text editor and search for image002.jpg and replace everything you find with image001.png (adapt the file names to the ones that you get). Then save it and your problem is fixed. If you want to save disk space, you can delete the compressed JPG image since it's no longer useful.

Word doesn't do this compression to save disk space (since the original image is still there), but so that if you change the image in Word (rotate it, change it's size, etc), Word handles it itself instead of letting the browser handle it. Word prefers to create a new image rather than use some complicated HTML5 which can in some cases have unwanted effects in some browsers. The reason why it uses VML in browsers that support it is because VML is, just like Word, developed by Microsoft so they already know which effects VML will have. For this reason, you can't disable this feature in Word, you have to edit the HTML source yourself as I explained.

As Mario pointed out in the comment, I recommend always editing the HTML source yourself rather than editing the HTML document with Word. If you edit it with Word, other than the issue in your question, you will for example get a lot of useless HTML which will considerably increase the size of your HTML document. For example, for using a PNG image in an HTML document, Word generates this code:

<span style="mso-no-proof:yes"><!--[if gte vml 1]><v:shapetype
 id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
 path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
 <v:stroke joinstyle="miter"/>
  <v:f eqn="if lineDrawn pixelLineWidth 0"/>
  <v:f eqn="sum @0 1 0"/>
  <v:f eqn="sum 0 0 @1"/>
  <v:f eqn="prod @2 1 2"/>
  <v:f eqn="prod @3 21600 pixelWidth"/>
  <v:f eqn="prod @3 21600 pixelHeight"/>
  <v:f eqn="sum @0 0 1"/>
  <v:f eqn="prod @6 1 2"/>
  <v:f eqn="prod @7 21600 pixelWidth"/>
  <v:f eqn="sum @8 21600 0"/>
  <v:f eqn="prod @7 21600 pixelHeight"/>
  <v:f eqn="sum @10 21600 0"/>
 <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
 <o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Bildobjekt_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75"
 <v:imagedata src="Dok1-filer/image001.png" o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><img width="624" height="431" src="Dok1-filer/image002.jpg" v:shapes="Bildobjekt_x0020_1"><!--[endif]--></span>

If you would write the source code yourself, it would look something like this:

<img src="Dok1-filer/image001.png" width="624" height="431"/>

Therefore, I recommend always writing the source code yourself instead of letting Word do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.