Why do images copied to Libre Office Writer look so pixelated?

9

2

When you copy this image

enter image description here

and paste it (via drag and drop from Google Chrome) to Libre Office Writer (4.3.3.2) you get:

enter image description here

Why is this so pixelated / fuzzy?

Somehow it does not copy the original image. How can I tell it to copy it in the original size by default?

But even after setting it to the original size, it is still pixelate. How can I fix that?

Martin Thoma

Posted 2015-02-21T11:21:26.033

Reputation: 2 705

This is also a problem when I insert it as a file from my computer. However, if I include it as a SVG it looks just fine. – Martin Thoma – 2015-02-21T12:07:12.347

My guess is that it gets compressed to save space. – TheKB – 2015-02-21T15:08:02.737

@TheKB Do you know how to disable it? – Martin Thoma – 2015-02-21T15:16:22.917

I don't, sorry. – TheKB – 2015-02-21T16:11:48.083

Answers

7

This is a known issue in LibreOffice (tdf#86675) where PNG images being imported/inserted and scaled are using "Nearest neighbor" in rendering the document canvas, rather than more common Bilinear, or BiCubic (Catmull-Rom) pixel interpretation on scaling. Also, for now in LibreOffice, believe PNGs with Alpha channel are always "scaled" using nearest neighbor.

Especially an issue on Linux builds, less so on Windows builds.

So, if you can prepare your PNG to the exact size needed, as well as prepare or convert to a non-Alpha channel PNG (using ImageMagick's "convert input.png -background white -alpha remove output.png" or similar utility), you should be able to have acceptable image insertion and rendering in a LibreOffice document.

See: https://bugs.documentfoundation.org/show_bug.cgi?id=86675

V Stuart Foote

Posted 2015-02-21T11:21:26.033

Reputation: 206

Removing Alpha (in Gimp) didn't work for me. gif, bmp does not work either. – Bevor – 2016-08-04T19:22:35.760

It doesn't even work with Libre office 5, what a crap. – Bevor – 2016-08-04T19:35:32.583

First of all it looks that it doesn't work either, but when I scale it down inside LibreOffice Calc, it looks good. – Bevor – 2016-08-04T19:40:49.870

-3

Here's a blowup of the original image, ripped from here: enter image description here

You can see clearly that if this is an image in the first place, it's low quality. Blowing it up more with a graphic tool shows it more clearly:

enter image description here

If the first one is an image in the first place, it's originally text data and the font has been smoothed. Because of this the image is not uniformly black and white, but some pixels have grey values. This kind of font smoothing happens everywhere, it's a necessity. Because a pixel is a square, you cannot have any other smooth lines but perfectly horizontal and perfectly vertical, so font smoothing is used to trick viewer's brain.

What causes the pixelation in paste is basically what TheKB says: compression. What you are pasting is a bitmap image, and compression causes loss of image data; you lose grey values. This compression is done by LiberOffice itself.

When you import an SVG, you import a vector graphic. This is a completely different way of producing graphic, those you can upscale without any limitations. A vector graphic will always look exactly the same whether you put it on a stamp or Hoover Dam.

Here's why (simplified version):

enter image description here

The image above shows a simple black square, size 4x18 pixels, color black. If this image is a bitmap, you must specify individually the location and color of each pixel. Let's assume one byte for x, one byte for y and one byte for color and we get 4 x 18 x 3 = 216 bytes of image data.

If this image is a vector, you only need to specify the location of each corner. With these locations you define an area, and color to fill this area. Location is still two bytes for each pixel, but color only takes additional one byte - 4 x 2 + 1 byte = 9 bytes of image data. So a vector image is much simpler than a bitmap.

You didn't put here an example of an imported SVG but if you blow it up it should show pretty much similar to the first image above. LibreOffice will smooth the round and angular lines. However since there's so much less image data, there's nothing to compress.

So what this boils down to is the way LibreOffice handles different image formats. To get your copy-paste look exactly like the original, you need to find out a way to force LibreOffice to paste without loss, 100% quality. Alternatively keep importing vectors.

Peregrino69

Posted 2015-02-21T11:21:26.033

Reputation: 210

This is not an answer. The included image should be as sharp as the original is. This is not the case. – Martin Thoma – 2015-02-21T14:59:13.483

Updated. Hopefully the expanded explanation helps you. – Peregrino69 – 2015-02-24T19:37:03.117

I know what pixel graphics / vector graphics are. I only mentioned it, because one might suppose another problem. You still don't answer the core question: Why does libreOffice compress the image and how can I deactivate it? – Martin Thoma – 2015-02-24T19:46:52.343

"Why LO compresses" - if this is a design, I'm not exactly convinced this is the best place for answers. This could be a bug - did you check LO bug database? Or did you check if current version (4.4) behaves the same way? Have you checked the actual LiberOffice forums, maybe someone has found the answer? Did you check Writer Help file? – Peregrino69 – 2015-02-24T20:06:49.853