Bug 395074 - Incorrect image size when exporting a vector layer as SVG at 72 DPI
Summary: Incorrect image size when exporting a vector layer as SVG at 72 DPI
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layers/Vector (show other bugs)
Version: 4.0.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-06 06:17 UTC by Anna Medonosova
Modified: 2018-06-26 15:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anna Medonosova 2018-06-06 06:17:41 UTC
When I create a new image with 72DPI, create a vector layer and then export it, the resulting SVG has the original width and height in pixels, but uses the unit of pt. When I reopen the SVG file, the pts are converted to pixels, making the image larger than the one I started with.

With DPI of 300, the sizes are exported correctly.

It works the same on stable and on the latest nightly build (krita-4.1.0-pre-alpha-8a777b5-x86_64.appimage).


Steps to reproduce:
  1, Create a new image, 200x200px, at 72dpi
  2, Create a vector layer, draw something
  3, Export layer as SVG. The SVG file has width and height set to 200pt.
  4, Open it again in krita. The status bar now says 278*278. When you export the layer again, the SVG file has width and height of 200pt.
Comment 1 Dmitry Kazakov 2018-06-06 09:51:56 UTC
Hi, Anna!

The problem happens because Krita selects default resolution for importing a vector image as 100dpi. Right now you can go to Image->Scale Image to New Size and just rescale the image to original 72 dpi. 

We should implement a special dialog that would ask the user about preferred import DPI
Comment 2 Dmitry Kazakov 2018-06-06 09:54:54 UTC
If you just load the SVG image as a separate image in Krita and then Copy-paste it into the image or any resolution, it will be embedded correctly.
Comment 3 Dmitry Kazakov 2018-06-06 11:03:23 UTC
Git commit 8d9ccd8d9253d9f0fa507cff357dbb4a67c61171 by Dmitry Kazakov.
Committed on 06/06/2018 at 11:03.
Pushed by dkazakov into branch 'master'.

Ask the user about the resolution he wants to use for loading SVG images

M  +10   -0    libs/ui/kis_config.cc
M  +3    -0    libs/ui/kis_config.h
M  +22   -1    plugins/impex/svg/kis_svg_import.cc

https://commits.kde.org/krita/8d9ccd8d9253d9f0fa507cff357dbb4a67c61171
Comment 4 Anna Medonosova 2018-06-06 12:29:29 UTC
Thanks for both the clarification and new functionality.
Comment 5 Andrey 2018-06-26 15:02:23 UTC
Git commit 03513a5b0b0c32c2d63f5e995626ac263a7134b8 by Andrey Kamakin, on behalf of Dmitry Kazakov.
Committed on 26/06/2018 at 14:18.
Pushed by akamakin into branch 'akamakin/T8628-multithreading-optimization'.

Ask the user about the resolution he wants to use for loading SVG images

M  +10   -0    libs/ui/kis_config.cc
M  +3    -0    libs/ui/kis_config.h
M  +22   -1    plugins/impex/svg/kis_svg_import.cc

https://commits.kde.org/krita/03513a5b0b0c32c2d63f5e995626ac263a7134b8