Bug 407425 - SVG file width and height changes while import
Summary: SVG file width and height changes while import
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 4.2.0-alpha
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-11 11:57 UTC by JoeRex
Modified: 2019-10-04 08:01 UTC (History)
2 users (show)

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


Attachments
Import SVG stretches in Krita (234.84 KB, image/png)
2019-05-11 11:57 UTC, JoeRex
Details
Hexagon - SVG File (1.42 KB, image/svg+xml)
2019-05-11 12:02 UTC, JoeRex
Details
Inkscape SVG file import test - works fine (206.40 KB, image/png)
2019-05-11 12:19 UTC, JoeRex
Details
SVG export from Krita to Affinity Works fine (189.46 KB, image/png)
2019-05-11 12:43 UTC, JoeRex
Details

Note You need to log in before you can comment on or make changes to this bug.
Description JoeRex 2019-05-11 11:57:09 UTC
Created attachment 119981 [details]
Import SVG stretches in Krita

SUMMARY
I imported an SVG file from Affinity Designer to Krita. Whenever I import the files the image looks stretched. I have set the dpi in Krita as "100"



STEPS TO REPRODUCE
1. exported a simple shape in SVG format in Affinity designer
2. imported the SVG in Krita
3. Set the preferred resolution as "100"
4. The file is stretched (please check the screenshots)

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: Windows 10 Pro 64Bit

ADDITIONAL INFORMATION
Krita build: 4.2.0-alpha (git 220be8f) [May 11, 2019]
Comment 1 Tiar 2019-05-11 11:59:05 UTC
Can you please open it also in Inkscape and check if it appears stretched there, too?

Also could you please attach the file here?
Comment 2 JoeRex 2019-05-11 12:02:05 UTC
Created attachment 119982 [details]
Hexagon - SVG File

Hi,

Kindly find attached the SVG File, that I opened with Krita.

Thank You
Comment 3 JoeRex 2019-05-11 12:19:55 UTC
Created attachment 119983 [details]
Inkscape SVG file import test - works fine

I tried to import the file in Inkscape. It works fine with the exact measurements. Please check the screenshot.
Comment 4 JoeRex 2019-05-11 12:43:59 UTC
Created attachment 119986 [details]
SVG export from Krita to Affinity Works fine

Hi,

I tried creating a simple shape in Krita and exported the file in SVG. Then I Imported the file in Affinity Designer. SVG export from Krita works fine.

Only the SVG import is not working properly.
Comment 5 JoeRex 2019-05-11 12:49:07 UTC
And I have a question.
Why the vector shape edges are pixelating in Krita? Is it a bug?

please check the above attached screenshot. [attachment 119986 [details]]
Comment 6 vanyossi 2019-05-11 13:33:25 UTC
The problem seems to be that Krita reads the property "viewBox" to set the aspect ratio which is wrong. Other programs interpret the "viewBox" as the real pixel size of the image, like the framed window we can see trough.

About the pixels in krita. this is not a bug, Krita is a raster image based painting program. And the "viewport" of krita is pixel based. In this way to show you the vector it "rasters" (converts to pixel representation" the vector reprentation) If you don't like to see pixels, use more pixels, that is, make a bigger image. Vector programs does not show pixel while editing, but after exporting to png/jpg,/tiff you will see the same pixels as they need to "raster" that vector shape also.
Comment 7 JoeRex 2019-05-11 15:46:10 UTC
I understand. Thanks for the quick response.
Comment 8 vanyossi 2019-10-03 22:46:15 UTC
Git commit 9fb11a3ed3a1b6ab34c94ea7dcf76d4c118c71cc by Ivan Yossi.
Committed on 03/10/2019 at 20:13.
Pushed by ivany into branch 'master'.

Fix wrong aspect ratio on SVG Load

We incorrectly treated the absence of preserveAspectRatio
as set to "none". Svg specification states the initial value
of this property should be "xMidYMid meet". in case there
is no property we now use the initial value instead of
ignoring.
    
Updated TestSvgParser cases to use "none" so the resulting
shape corresponds to the old behaviour.

M  +3    -4    libs/flake/svg/SvgUtil.cpp
M  +7    -0    libs/flake/tests/TestSvgParser.cpp

https://invent.kde.org/kde/krita/commit/9fb11a3ed3a1b6ab34c94ea7dcf76d4c118c71cc
Comment 9 Halla Rempt 2019-10-04 08:01:28 UTC
Git commit 218dbca4142a27e4f17de006d3f2297af9a8082c by Boudewijn Rempt, on behalf of Ivan Yossi.
Committed on 04/10/2019 at 07:59.
Pushed by rempt into branch 'krita/4.2'.

Fix wrong aspect ratio on SVG Load

We incorrectly treated the absence of preserveAspectRatio
as set to "none". Svg specification states the initial value
of this property should be "xMidYMid meet". in case there
is no property we now use the initial value instead of
ignoring.
    
Updated TestSvgParser cases to use "none" so the resulting
shape corresponds to the old behaviour.
(cherry picked from commit 9fb11a3ed3a1b6ab34c94ea7dcf76d4c118c71cc)

M  +3    -4    libs/flake/svg/SvgUtil.cpp
M  +7    -0    libs/flake/tests/TestSvgParser.cpp

https://invent.kde.org/kde/krita/commit/218dbca4142a27e4f17de006d3f2297af9a8082c