Pictures add double their file size to writer document

I’ve been trying to figure out how to make it not do this for hours.

I updated to 7.5.8.2, and it still does this. I created a test text document that is 70 kb when saved. Drag 6 JPG files totaling 1.9 MB onto the document and save. Document is now 3312 kb. Drag more JPG files; the total of all is now 3.23 MB. File size when document is saved is now 9,775 kb.

I have looked through all the settings for something that might be causing it to save pictures twice or something, but can’t find anything. Is there a way to fix this, or is this program just super inefficient?

As an update, I just installed wordpad to test how it would do, and it added 10x the jpeg size to the document size, so that’s no good. But perhaps there is another program that does better? It seems like you should be able to add files intact without too much overhead.

—SOLUTION—

Piecing together the below responses, and from further examination, this seems to be what is happening:

I’m an old fogey who renames webp files to jpg because they look like ‘webpage’ to me. Turns out that Writer (at least version 7.5.8.2) was purposely set to convert webp files to PNGs for reasons that are still unclear to me. Regardless, Writer’s context menu compression option seems to do a fine job of quickly turning that png into a jpg without needing any other program.

If you insert a jpg through the Insert menu or drag it from the file manager into Writer it should be inserted as a jpg into the file. The file size should increase by the size of the jpg plus a few bytes for the XML.

It might be an additional image was dragged in because an image was not visible for some reason, possibly hidden behind another image. Check using Navigator that you have the correct number of images.

Note that copying and pasting an image from elsewhere will insert it as a PNG file with a commensurate increase in size.

2 Likes

Are you sure your JPG files are really JPG? Because often WebP files are named JPG. The thing is: we save WebP in files together with a fallback; and that makes two images instead of one.

Also: isn’t your document an RTF by chance? In which case, binary data would need a textual encoding in it, which increases size of the document. Avoid RTFs as much as you can.

3 Likes

Always use the regular method to embed images into the document: Insert - Image (from the menu)
.
And always optiize the images BEFORE you embed them into a document. A huge pixel size image with millions of color shades can not give you more informations than the optimized one (with optimized physival and pixel size, and 256 color shade) can in a printed/pdf exported/displayed office document.

2 Likes

@Elfis
I embedded a PNG image of ca. 199 kB (via menu Insert…) into a Writer file. The Writer file space increased after embedding the image of 199 kB for around 210 kB which contradicts your observations.

A true answer could give an examination of your .odt file. Rename the file to extension .zip and unzip it.
The folder pictures within the .zip file shows the embedded images.
Note: I directly unzipped the .odt file.

.

Note that LibreOffice uses a technique to deduplicate images, when saving to ODF and OOXML; so no matter how many copies of the same image you inserted, the file size should only increase by one image (the XML data size is negligible).

So:

  • it is OK to drag files (the advises like “always use the regular method … from the menu” are wrong);
  • several copies in the same document do not increase file size significantly, when you use ODF or OOXML.

Indeed, optimizing images is a good advise per se, but - as I mentioned above, first you need to exclude possibility of legitimate causes of your observed phenomena; and in case when you still see a 2x size increase after inserting true JPG into an ODT, then it might be a real bug.

1 Like

I’m still reading and processing the responses, but when I went to compress the images with the right click menu, I saw that some but not all of them have been converted to PNG files, and are much larger than the originals. It turns out, those are the WebP files. But the originals are much smaller. Dragging one of the WebP images into the document seems to turn it into an 800k PNG instead of its original 111k (exact numbers vary by file).

So I need to figure out how to make it stop changing the file. Perhaps it can’t read whatever file format the WebP is encoded with and so converts it into a PNG? Do I need to download extra codecs or something?

Another update: Just using the ‘compress’ option from the right click menu in Writer and having it convert the pictures to jpg quartered the size of the document file. I would still like to know, if anyone can explain, exactly what is happening with the WebP files when I put them into the document and they turn into much larger PNGs?

https://wiki.documentfoundation.org/ReleaseNotes/7.4#General_Improvements_3

I was even wrong about saving a fallback (it was wishful thinking after a discussion in tdf#114532, where comments 26 and later suggested that fallback…)

1 Like

Please upload or link one of them here.

Checking the Pictures folder in the .odt file told me the following:

  • A webp image of 518,7 kB automatically increased/converted to a png file of 5,3 MB.
  • Writer could compress the embedded png file (5,3 MB - compression 9, resolution from 300 to 150 dpi) into another png file of 682,5 kB.
  • Writer could compress the embedded webp image of 518,7 kB into jpg format (80% compression; same resolution) of 392 kB size.

Working on GIMP I got the following results:

  • A webp image of 518,7 kB was exported to a .jpg file:
    • 881 kB (90% compression) resp. 518 kB (80% compression)

At the moment it seems to be sensible to export the webp file into another format before embedding in Writer. See e.g. @Zizi64’s advice here in this topic.

IMHO an enhancement request could be a consequence in regard to my results. The enhancement is to display the webp image as a webp image. Probably the webp image format still is in a state of development (I am not sure).
.
Tested image:
Image: https://file-examples.com/storage/fe83b11fb06553bbba686e7/2020/03/file_example_WEBP_500kB.webp
URL of samples: Sample .webp download | File Examples Download

Check the URL or search on the internet “webp image download”. It is easy to find examples.

Yes, I can download WebP images. But I need one of the actual ones: Are they images of the nature, or people, or they are lineart style computer graphics? The result of the reducing depends on the type (content) of the image.

1 Like

Here’s one of the webp images. IMG_5861_JPG.webp - Google Drive

When I put it in an odt that’s open in writer, the picture appears, but it says unknown file type. Saving the document saves it as a png.

Now that I know how it works, it’s not a problem; Writer seems to do a fine job of turning the png back into a jpg without needing any other program; I was just wondering if there were a way to get Writer to understand the webp files like it understands jpg.

1 Like

Converted to real .jpg format by the IrfanView software with Quality value: 60


.

And here is an .odt document with the image inside:
Real JPG.odt (143.1 KB)

The image size is 82.2 KiB inside the ZIP archive.

Lol. Have you even read my links to the release notes? We added support for WebP; but explicitly made it convert to PNG, because of backward compatibility … so much of imagination wrt “handling of an unknown file type”…

I will amend my theory.

LoL indeed. I’ll get right on reading the patch notes of every program that causes me a problem.

1 Like

I figured I should come back and clarify that webp files are the ones Writer automatically converts to PNG; not webm. I was tired when I wrote the solution on the original post, and now it doesn’t let me edit it anymore.

Thanks for confirming this, I was wondering if it did that. But it looks like there are a few nuances, at least in LibreOffice 7.4 on Debian 12:

  • Inserting multiple copies of the same SVG image into an ODS spreadsheet results in the filesize being bigger by the SVG image size multiplied by the number of copies, i.e. no dedupe.
  • When copying a sheet that contains the embedded SVG it does appear to deduplicate. However, this doesn’t help me because I just need to replace the same embedded SVG on all sheets with an updated version.

You can drag JPG images into Writer documents. You can also copy and paste JPG images into Writer documents. But I do not recommend either of these methods.

The above methods insert images that are much bigger than necessary. As you’ve discovered, the file size of your Writer document can quickly grow causing various problems. Resizing these images or cropping them within the Writer document does not actually reduce the size of the images. These methods simply make the images look smaller.

I always recommend saving any acquired JPG image to a folder on your computer. Then, use a raster imaging program to resize the image to approximately the size you want it to be in your document. Save this resized image under a different name, or the same name with SM added. When you later insert the new smaller image into your Writer document, you will find that the size of your Writer document does not increase nearly as much. Your Writer document will be easier to work with and you will be able to share it with others more easily.

The issue is not that the pictures are increasing the size of the document. The issue is that the pictures are increasing the size of the document by twice their actual size. If I halve their size, they still increase the document’s size by twice their new smaller size.

Now, it may be that no word processor can add pictures without additional bloat, though I don’t know why it shouldn’t be possible. As I said, I tried Wordpad, and it was abysmal, increasing file size by 10x the picture’s size.

I was just hoping there is a setting somewhere that can improve it, or a suggestion for a program that does it perfectly.

And I did try resizing the image within Writer. Contrary to your assessment, that does work fine. If it says it got a 62% reduction, you got a 62% reduction. But it’s still adding more file size than the size of the image.

That’s not the case for me.

I opened a blank document and added dummy text and saved it, which results in 34.4 kB.
I have added an image with 3.99 MB, which results in 4.05 MB after saving.
Then I added another image with 2.37 MB, which results in a display of 6.11 MB for the document after saving.


With me:

Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL threaded

2 Likes