Bug 51965

Summary: FORMATTING: Image pixelation
Product: LibreOffice Reporter: J.D. <jgallaway81>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: frob, l.lunak
Priority: medium    
Version: 3.5.2 release   
Hardware: Other   
OS: All   
Whiteboard: BSA
Crash report or crash signature: Regression By:
Attachments: A twin-monitor screen capture of the image being pixellated. Showing my bug report, as well as the Writer view zoom slider @ 100%. That image is FAR more detailed than shows up in the picture. Original image is 3872px by 830px, PNG format.
Original PNG file that doesn't render correctly in Writer.

Description J.D. 2012-07-10 20:36:48 UTC
Created attachment 64083 [details]
A twin-monitor screen capture of the image being pixellated. Showing my bug report, as well as the Writer view zoom slider @ 100%. That image is FAR more detailed than shows up in the picture. Original image is 3872px by 830px, PNG format.

Problem description: 

Steps to reproduce:
1. Insert -> Picture -> From File...
2. Select LARGE image, PNG format
3. Click OK

Current behavior: Image very pixelated, missing many details

Expected behavior:a fine-quality resizing of the image.

Platform (if different from the browser): 
              
Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Comment 1 Valek Filippov 2012-07-10 23:40:04 UTC
Could you please attach a sample image which may be used to demonstrate the problem (eg. one you used in the screenshoted document)?
Comment 2 J.D. 2012-07-11 13:50:49 UTC
Created attachment 64109 [details]
Original PNG file that doesn't render correctly in Writer.

This picture is one of several I have drawn of this style.

I thought maybe the problem was the size, but was unable to find a shrunken size which would render clearly. Any shrinking results in the image being de-focused, as though the program was being forced to enlarge it to import it into the file.
Comment 3 Valek Filippov 2012-07-11 22:30:21 UTC
Did you draw it in any vector image editor or CAD?
You can try to save into vector format (like SVG) and insert it like this, or scale vector and rasterize into smaller raster (eg. PNG) file.

If you open it in browser it would look very close to what LO shows. GIMP makes a slightly better job, so probably interpolation algorithm in LO for inserted images could be changed to a better one.
But at the end of the day an image of that size has to be scaled down to be shown on the screen and that means some details would be lost.
Comment 4 J.D. 2012-07-12 14:30:17 UTC
I hate to have to re-install MS Word, but if its needed, I can.

I last used MS Office 2000, and its version of Word did a great job of rendering the images properly.

If you have access to Word, use the "original" image that I attached and import it into word so that it fills the entire page. If you then compare the LO with MSO-W results you should see the difference. 

Let me know if you need me to install Word on my system and do a screen shot of the image rendering in both applications.

As for drawing the images, they are drawn, pixel by pixel in MS Paint and natively saved in the PNG format
Comment 5 Valek Filippov 2012-07-14 15:27:22 UTC
J.D.,
I've checked with MS Word, it makes about the same interpolation as GIMP.

Lubos already added Lanczos interpolation to development version of the LibreOffice.
For now as a kind of workaround (not the ideal one though) you can open your pictures in GIMP, downscale them to appropriate size using "Lanczos3" as an interpolation option and insert smaller picture into the document.

Taking into account very impressive work you did in raster editor, I wonder if you ever tried vector editors and would like you suggest to try it if you didn't (eg. Inkscape, http://www.inkscape.org)

2 Lubos, would you be able to give some pointers to fixes and probably any estimation if it could be available in some 3.6.x version?
Comment 6 Luboš Luňák 2012-08-24 13:12:27 UTC
This has been improved in master (baca49fdda5e350b7b0f122d50739ee98cc6fe25), but the slower scaling needs a number of caching fixes, so it's a question if this will be backported.