Bug 107703 - Improve initial sizing of inserted images
Summary: Improve initial sizing of inserted images
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 86176 (view as bug list)
Depends on:
Blocks: Writer-Images Image-DPI
  Show dependency treegraph
 
Reported: 2017-05-08 15:37 UTC by Telesto
Modified: 2023-09-25 20:45 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot (232.22 KB, image/png)
2017-05-08 17:04 UTC, Yousuf Philips (jay) (retired)
Details
Example file (239.06 KB, application/vnd.oasis.opendocument.text)
2017-05-08 17:55 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2017-05-08 15:37:54 UTC
Description:
When insert a image I noticed that the image is way to large

Steps to Reproduce:
Steps:
1) Open Writer/Draw
2) Insert an image this image http://www.exiv2.org/include/img_1771.jpg using Insert -> Image
3. 'Import' the same image by copy pasting from Firefox

Actual Results:  
Image is page filling

Expected Results:
The image should of the size similar to the Firefox copy/paste


Reproducible: Always

User Profile Reset: No

Additional Info:
Found in
Version: 5.4.0.0.alpha1+
Build ID: 274ecb49b70b3f01d47546e3b44317946c106042
CPU threads: 4; OS: Windows 6.2; UI render: default; 
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2017-05-05_22:45:07
Locale: nl-BE (nl_NL); Calc: single

and in
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4


User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Comment 1 Yousuf Philips (jay) (retired) 2017-05-08 17:04:03 UTC
Cant repo. If i copy the file in Firefox or Vivaldi, it pastes it into the document at 96 dpi and has the same number of pixels.
Comment 2 Yousuf Philips (jay) (retired) 2017-05-08 17:04:26 UTC
Created attachment 133162 [details]
screenshot
Comment 3 Telesto 2017-05-08 17:55:52 UTC Comment hidden (obsolete)
Comment 4 Regina Henschel 2017-05-08 19:25:58 UTC
How do you do Insert -> Images? Do you have stored the images to your hard disk; if yes, in which way? Or do you have entered the URL in the file name field in the file picker?

If I do the latter, I get an image of 16,9cm x 12,7cm at 72dpi.
Comment 5 Telesto 2017-05-08 20:30:51 UTC
@Regina Herschel
That's exactly my point ;-) When I import the image (on Windows) I get 16,9cm x 12,7cm at 72dpi (same as you). However it should be 12,70 cm x 9,53 cm at 96 dpi (like in the screenshot of Jay).

I can get the same result as Jay, if I open the image in Firefox first and then copy it into the Writer Document.
Comment 6 Regina Henschel 2017-05-08 20:47:51 UTC
You mean right-click in browser and copy to clipboard? Then I (using Seamonkey) get 120dpi; that is my screen resolution. It might be, that Firefox changes the dpi-information when putting the image to clipboard. With a "save link target" I get 72dpi.
Comment 7 Yousuf Philips (jay) (retired) 2017-05-08 21:21:35 UTC
(In reply to Telesto from comment #3)
> I get the same results as you when copy/pasting from Firefox, but not when
> inserting images using Insert -> Images (or drag and drop). I get a mismatch
> between the actual dimension (correct) and the apparent dimension (wrong).

Yes images inserted through the Insert dialog fill the page, as that is who it is supposed to be. I mistakenly thought you were saying its not coming the right way through copy/paste from the browser.
Comment 8 Telesto 2017-05-12 16:48:14 UTC Comment hidden (obsolete)
Comment 9 Yousuf Philips (jay) (retired) 2017-05-13 00:29:59 UTC
(In reply to Telesto from comment #8)
> I'm still not fully convinced that the image should be imported as 16,9cm x
> 12,7cm

Okay lets ask some others. @Tomaz, @Stuart, @Cor, @Hieko: Should images be imported into a document with a dpi below 96 and be stretch the width of the page, rather than keeping it at 96 dpi and having it take up less width on the page?

> If have opened the file in multiple applications and the outcome isn't that
> consistent. Quite often it's resulting in: 12,70 cm x 9,53 cm
> For example: Word Online or Google Docs

Opening the image in MS Word 2010 shows it as 6.77 cm x 5.08 cm, while WPS shows it the full width of the page at 15.92 cm x 11.94 cm.
Comment 10 Cor Nouws 2017-05-13 08:43:13 UTC
I've no preference in this situation.
I think in general inserting an image will be followed by an action to set size and position etc (by hand or style or macro), so I consider the initial situation as less interesting anyway. But that's me.
Comment 11 Tomaz Vajngerl 2017-05-13 09:55:05 UTC
At least we should be consistent... not one time use this and the other time that. If a picture has DPI set then we could use that to calculate the size, otherwise we could use some default DPI - not dependent on system DPI.
Comment 12 Regina Henschel 2017-05-13 11:57:49 UTC
LibreOffice must never change any information, that is contained in the png-image. "dpi" or to be more correct the "physical pixel dimension" chunk belongs to the png-image. If the image does not fit into a page in Writer depending on that information, the view of the image is scaled down (see crop tab in properties dialog), but the image is not changed.

If the pixel size information is missing or has no unit, then we can discuss, which ersatz LibreOffice should use. I agree with Tomaz, that it should not depend on system DPI. Perhaps 96 dpi is good, that is used for SVG-graphics in case the unit is "px".


(In reply to Yousuf Philips (jay) from comment #9)
Should images be
> imported into a document with a dpi below 96 and be stretch the width of the
> page, rather than keeping it at 96 dpi and having it take up less width on
> the page?

Always use the original dpi to calculate the size. Only scale the view, if otherwise it cannot be inserted. Do not scale up. Likely the user wants to put text besides the image.
Comment 13 Heiko Tietze 2017-05-18 06:43:32 UTC
(In reply to Yousuf Philips (jay) from comment #9)
> Okay lets ask some others. @Tomaz, @Stuart, @Cor, @Hieko: Should images be...

Fully agree with Regina.
Comment 14 Yousuf Philips (jay) (retired) 2017-05-30 19:45:59 UTC
*** Bug 86176 has been marked as a duplicate of this bug. ***
Comment 15 QA Administrators 2019-03-01 03:49:25 UTC Comment hidden (obsolete)
Comment 16 QA Administrators 2021-03-01 04:08:00 UTC Comment hidden (obsolete)
Comment 17 Timur 2022-05-19 10:25:51 UTC
Paste from Firefox and insert image are the same. Size 16,9cm x 12,7cm is the same as in IrfanView for print. DPI in IrfanView is 72, how do you determine it's not OK in LO?
After reading all this, I don't know what bug is about. Needinfo.
Comment 18 QA Administrators 2023-03-31 03:29:32 UTC Comment hidden (obsolete)
Comment 19 Telesto 2023-03-31 06:02:11 UTC
(In reply to Timur from comment #17)
> Paste from Firefox and insert image are the same. Size 16,9cm x 12,7cm is
> the same as in IrfanView for print. DPI in IrfanView is 72, how do you
> determine it's not OK in LO?
> After reading all this, I don't know what bug is about. Needinfo.

Results differ. The image - like http://www.exiv2.org/include/img_1771.jpg - has no embedded DPI 

Insert -> Image 
Imports the image at 72 DPI: image size 16,93cm x 12,70cm

Copy/Paste from browser
Imports the image at screen dpi: macbook has 128 DPI: image size 9,53 x 7,14cm
Comment 20 QA Administrators 2023-04-01 03:23:36 UTC Comment hidden (obsolete)