Open JoKalliauer opened 5 years ago
As I understanding it, the underlying issue here is that scour fails to cope with the fact that gradientUnits
is effectively set to userSpaceOnUse
via the xlink:href
. If it had been set directly on the <linearGradient>
tag then I think the code would not have pruned it.
Related xlink:href
is allegedly deprecated according to https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient.
Correction; I think what they are talking about is that the xlink:
prefix is deprecated in SVG 2.
Hi @JoKalliauer
Could you check whether #271 fixes this problem for you? :)
@nthykier
Could you check whether #271 fixes this problem for you? :)
To answer your Question: Not shure if I can. ;)
python3 -m pip install --upgrade pip --user
pip3 install --upgrade https://github.com/codedread/scour/archive/master.zip --user
pip install https://github.com/codedread/scour/archive/master.zip
scour --version
wget https://github.com/scour-project/scour/files/2896595/Input.svg.txt
scour Input.svg.txt Output.svg
vimdiff Input.svg.txt Output.svg
scour -i Input.svg.txt -o AllDeactivated.svg --indent=space --nindent=1 --disable-simplify-colors --disable-style-to-xml --disable-group-collapsing --keep-editor-data --keep-unreferenced-defs --protect-ids-noninkscape --disable-embed-rasters --set-precision=6
$ python3 -m pip install --upgrade pip --user
Requirement already satisfied: pip in /home/jkalliau/.local/lib/python3.8/site-packages (21.0.1)
$ pip3 install --upgrade https://github.com/codedread/scour/archive/master.zip --user
Collecting https://github.com/codedread/scour/archive/master.zip
Using cached https://github.com/codedread/scour/archive/master.zip
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3.8/site-packages (from scour==0.38.2) (1.14.0)
$ pip install https://github.com/codedread/scour/archive/master.zip
Defaulting to user installation because normal site-packages is not writeable
Collecting https://github.com/codedread/scour/archive/master.zip
Using cached https://github.com/codedread/scour/archive/master.zip
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3.8/site-packages (from scour==0.38.2) (1.14.0)
$ scour --version
0.38.2
$ wget https://github.com/scour-project/scour/files/2896595/Input.svg.txt
--2021-02-28 10:17:51-- https://github.com/scour-project/scour/files/2896595/Input.svg.txt
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-repository-files.githubusercontent.com/13775110/2896595?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210228%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210228T091751Z&X-Amz-Expires=300&X-Amz-Signature=610f3473a61c0a634994c220523ed22022c060e2fa633f788d22e371bb62ebd0&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=13775110&response-content-disposition=attachment%3Bfilename%3DInput.svg.txt&response-content-type=text%2Fplain [following]
--2021-02-28 10:17:51-- https://github-repository-files.githubusercontent.com/13775110/2896595?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210228%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210228T091751Z&X-Amz-Expires=300&X-Amz-Signature=610f3473a61c0a634994c220523ed22022c060e2fa633f788d22e371bb62ebd0&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=13775110&response-content-disposition=attachment%3Bfilename%3DInput.svg.txt&response-content-type=text%2Fplain
Resolving github-repository-files.githubusercontent.com (github-repository-files.githubusercontent.com)... 185.199.110.154, 185.199.111.154, 185.199.109.154, ...
Connecting to github-repository-files.githubusercontent.com (github-repository-files.githubusercontent.com)|185.199.110.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2434 (2,4K) [text/plain]
Saving to: ‘Input.svg.txt’
Input.svg.txt 100%[=========================================================================================================================================>] 2,38K --.-KB/s in 0s
2021-02-28 10:17:51 (20,2 MB/s) - ‘Input.svg.txt’ saved [2434/2434]
$ scour Input.svg.txt Output.svg
Scour processed file "Input.svg.txt" in 4 ms: 2413/2434 bytes new/orig -> 99.1%
$ vimdiff Input.svg.txt Output.svg
$ scour -i Input.svg.txt -o AllDeactivated.svg --indent=space --nindent=1 --disable-simplify-colors --disable-style-to-xml --disable-group-collapsing --keep-editor-data --keep-unreferenced-defs --protect-ids-noninkscape --disable-embed-rasters --set-precision=6
Scour processed file "Input.svg.txt" in 4 ms: 2413/2434 bytes new/orig -> 99.1%
--disable-simplify-colors --disable-style-to-xml --disable-group-collapsing --keep-editor-data --keep-unreferenced-defs --protect-ids-noninkscape --disable-embed-rasters
It seems like you were testing the master branch, but the relevant code has not been merged into master yet. Therefore, I do not think you have tested the change.
You might be able to test it by trying to use pip3 install --upgrade https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip --user
(remember to revert back to the master branch when you are done).
@nthykier I still get the same output
$ pip3 install --upgrade https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip --user
Collecting https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip
Using cached https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3.8/site-packages (from scour==0.38.2) (1.14.0)
$ scour Input.svg.txt Output.svg
Scour processed file "Input.svg.txt" in 4 ms: 2413/2434 bytes new/orig -> 99.1%
I also tried it with --force
pip3 install https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip --force
Defaulting to user installation because normal site-packages is not writeable
Collecting https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip
Using cached https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip
Collecting six>=1.9.0
Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Building wheels for collected packages: scour
Building wheel for scour (setup.py) ... done
Created wheel for scour: filename=scour-0.38.2-py3-none-any.whl size=59054 sha256=a03e2531fc8b2871c7a37ea8c5eb4747f018c844da125a2894a10103a8317cf5
Stored in directory: /home/jkalliau/.cache/pip/wheels/76/db/36/371ba3855fc9f0748e1ad16b5e96a05ff34c1e5cc1a2e19470
Successfully built scour
Installing collected packages: six, scour
Attempting uninstall: six
Found existing installation: six 1.15.0
Uninstalling six-1.15.0:
Successfully uninstalled six-1.15.0
Attempting uninstall: scour
Found existing installation: scour 0.38.2
Uninstalling scour-0.38.2:
Successfully uninstalled scour-0.38.2
Successfully installed scour-0.38.2 six-1.15.0
But scour Input.svg.txt Output.svg
also resulted in the same Output.svg.
Thanks for confirming. I was fooled by the test behaving differently than scour itself.
I have tested directly with scour on your input and now get the right result.
@JoKalliauer How come you closed this issue? The code fixing it has not been merged yet.
@nthykier Sorry https://github.com/nthykier/scour/archive/gh-225-gradient-fix.zip fixed the issue, but not the master-branch. After merging it can be closed.
Ack, thanks for verifying. :)
Prozessing File:Wing_camber_and_aileron_FAA_GFH.svg breaks the file.
scour Input.svg.txt Output.svg.txt
Input
Output
Difference
Rendering in Firefox
Similar rendering in Crome
Copyright
Lizense: Public Domain Source: https://commons.wikimedia.org/wiki/File:Wing_camber_and_aileron_FAA_GFH.svg