Bug 390337 - Document Object xRes, yRes and Resolution have different values.
Summary: Document Object xRes, yRes and Resolution have different values.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-12 18:38 UTC by wolthera
Modified: 2018-02-13 13:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wolthera 2018-02-12 18:38:02 UTC
1. Make a document with 72 dpi.
2. Go to scripter.
3. Execute following script:

-----------------------------------
import sys
from krita import *

doc = Application.activeDocument()

print(doc.resolution())
print(doc.xRes())
print(doc.yRes())
-----------------------------------

Note that resolution is 72, but xRes and yRes are 1.0... I am somewhat lost which ones need to go into ScaleImage now...
Comment 1 wolthera 2018-02-12 18:53:20 UTC
So, uh, this is kinda  serious bug, but I cannot fix it due to to not really undrstnading it.

Thing is, Krita for some reason assumes xRes and yRes are 1.0, which means they are 72 dpi. LibKis multiplies xRes by 72 dpi to give document.resolution()

document.scaleNode requests regular xRes and yRes though.

LiKis also doesn't allow setting the DPI of created documents, which are always set to 100, which SHOULD be 1.0 if it needs to be 72 dpi. (Like in Krita Sketch ImageBuilder::createBlankImage(int width, int height, int resolution) ) Which means that newly created images are always at 7200 dpi.

I uh, I am not sure how we should resolve all of this.
Comment 2 wolthera 2018-02-13 13:11:12 UTC
Git commit 60b81074027b7cbd68563b846dc5956b53828d6a by Wolthera van Hövell tot Westerflier.
Committed on 13/02/2018 at 13:08.
Pushed by woltherav into branch 'master'.

I am not sure why we have this crazy system at all...

M  +5    -5    libs/libkis/Document.cpp

https://commits.kde.org/krita/60b81074027b7cbd68563b846dc5956b53828d6a