Bug 151468 - Inserting TIFF-images will ignore dpi-information, always set to 96 dpi
Summary: Inserting TIFF-images will ignore dpi-information, always set to 96 dpi
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.0.3 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.4.3 target:7.5.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2022-10-11 08:15 UTC by Robert Großkopf
Modified: 2022-10-17 01:42 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Tif Image 120 dpi (5.03 KB, image/tiff)
2022-10-11 08:15 UTC, Robert Großkopf
Details
Tif Image 240 dpi (10.83 KB, image/tiff)
2022-10-11 08:16 UTC, Robert Großkopf
Details
Writer file with the images and their properties. (111.56 KB, application/vnd.oasis.opendocument.text)
2022-10-11 13:01 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2022-10-11 08:15:55 UTC
Created attachment 182966 [details]
Tif Image 120 dpi

Open a new Writer document.
Import the attached tif-files
(Insert → Image …)

Image for 240 dpi will be shown much bigger than image for 120 dpi. Bot images should have a width of ca. 5cm.

No right mouse click on the image → Properties → Crop. Information for the image is 96 ppi for every image, independent of real 240 ppi or 120 ppi.

This buggy behavior appears since LO 7.4.0.3. It won't appear in LO 7.3.6.2, also won't appear with other images like *.png or *.jpg.
Comment 1 Robert Großkopf 2022-10-11 08:16:26 UTC
Created attachment 182967 [details]
Tif Image 240 dpi
Comment 2 Telesto 2022-10-11 12:46:28 UTC
Confirm
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 9063d99ff5ee43cc1239fc1dbb5d9897bdda1c9b
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded

not with
Version: 7.1.8.0.0+ (x64) / LibreOffice Community
Build ID: a94b58277c7aeaa83ce14347cd0b8f7137969d03
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 3 m_a_riosv 2022-10-11 13:01:38 UTC
Created attachment 182972 [details]
Writer file with the images and their properties.

The images have different size with other win programs.
I'm about thinking if the bug was before, not now.
Comment 4 Robert Großkopf 2022-10-11 14:29:59 UTC
(In reply to m.a.riosv from comment #3)
> Created attachment 182972 [details]
> Writer file with the images and their properties.
> 
> The images have different size with other win programs.
> I'm about thinking if the bug was before, not now.

Seems your monitor has other resolution than mine. Here the default is 96dpi. So it will show the image for 240 dpi with a width of 12,46 cm, but it should be 5 cm.

Your monitor has resolution 120 dpi. So it will show the images a little bit smaller.

The normal way (with other images, tested here with png and jpg, also earlies LO-versions with tif) is to get the width by take the 461 pixel of the image, divide it by the resolution and all this multiplicate with 2,54 cm. 
461/240 = 1.92
1.92*2,54 = 4,88
Both images must have the same width and the same height in Writer, because the image with half of dpi also has half of pixel in width and height.
Comment 5 raal 2022-10-13 17:04:36 UTC
This seems to have begun at the below commit.
Adding Cc: to Caolán McNamara; Could you possibly take a look at this one?
Thanks
 3db1b6d5b8c5ee88b3b707ab6e236ae2e3ce834d is the first bad commit
commit 3db1b6d5b8c5ee88b3b707ab6e236ae2e3ce834d
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Sat May 21 11:58:25 2022 +0200

    source 22b50f1937de67e4ad9e692d6964aa5b8d33af7a

https://git.libreoffice.org/core/+/22b50f1937de67e4ad9e692d6964aa5b8d33af7a
Comment 6 Caolán McNamara 2022-10-13 20:18:06 UTC
https://gerrit.libreoffice.org/c/core/+/141345
Comment 7 Commit Notification 2022-10-14 05:40:24 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/846711ad526fcc147bb39df26bf2c2ff25a053f3

Resolves: tdf#151468 honour tiff resolution fields

It will be available in 7.4.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2022-10-14 07:54:29 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/aa451a4230778f9d4e6a931f51a60dba5f7a116a

Resolves: tdf#151468 honour tiff resolution fields

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.