Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup SVGs #814

Closed
matkoniecz opened this issue Jan 28, 2018 · 12 comments
Closed

cleanup SVGs #814

matkoniecz opened this issue Jan 28, 2018 · 12 comments

Comments

@matkoniecz
Copy link
Member

matkoniecz commented Jan 28, 2018

During my attempt to how one is supposed to export metadata (to fix my quest for #799) I discovered that SVGs saved by Inkscape are polluted by data that at best is useless and at worst is harmful (confuses search and may be a privacy problem for some)

I think that at least inkscape:export-filename should be deleted as https://github.com/westnordost/StreetComplete/blame/835eea29223a8201049083f17a263ea94abd9a37/res/appicon_flat-debug.svg#L20 and similar, with saving path to where file was stored are the most obnoxious and completely useless.

inkscape:export-filename="/home/mateusz/Documents/StreetComplete/app/src/debug/res/mipmap-ldpi/ic_launcher.png"

But I think that opening and resaving as "Optimized SVG" with Inkscape or running https://superuser.com/questions/739525/removing-personal-data-from-svg-file/1113543#1113543 or similar SVG cleaner would be a good idea to remove also other Inkscape cruft.

@rugk
Copy link
Contributor

rugk commented Jan 28, 2018

Yeah, but this is the task of each contributor. (To remove that info.)
So removing this once does not help.

However, I've found out you can workaround the problem if you use relative paths there, I.e. ./export.svg. Then only this relative path is saved.

@matkoniecz
Copy link
Member Author

you can workaround

Workaround is utterly unnecessary as this may be simply removed and not introduced again.

@rugk
Copy link
Contributor

rugk commented Jan 29, 2018

Then this is an issue you should raise in the Inkscape issue tracker. Here we can nothing do about it. As soon as you export the file, and save the file as a Inkscape SVG, Inkscape recreates this.
Not sure what you want to do here...

@matkoniecz
Copy link
Member Author

Have you read entire issue text? I linked solution.

@stefanb
Copy link
Contributor

stefanb commented Jan 30, 2018

I am having very good experience losslessly minifying SVGs with https://imageoptim.com/ which internally uses https://github.com/svg/svgo to get rid of all unnecessary data.

in #817 it Saved 1,8 MB out of 12,6 MB. 14,5% overall (up to 72% per file)

@rugk
Copy link
Contributor

rugk commented Jan 30, 2018

Optimizing images is fine sure. But only when this is the final image and you do not want to work with it.

However, the quests.svg e.g. cannot just be optimized. Because afterwards you cannot edit it in a useful way anymore.
So to make it clear: It is very useful to have the "Inkscape stuff" in there. E.g. the blue lines/grid or so.

Also, optimizing is not the solution for this problem in general. You can also just remove the export line manually in the source code. Or you just select "Normal SVG" when saving the file. (instead of Inkscape SVG)
However, when you open the file in Inkscape again, export it and save it as "Inkscape SVG" the export line including username and so on, is added again.

That's why I said it is the task of each contributor. When changing the file, you just have to save it in the correct format. That's it.

@stefanb
Copy link
Contributor

stefanb commented Jan 30, 2018

Agree, if there is stuff in there that helps you edit images later then that should be preserved in source control.

It seems that final image optimisation should be performed as a part of the (release) build, and optimized images discarded once the .apk is prepared.

What about other image types (.png, .jpg...), do they also contain stuff that should be preserved for further edits or can these be losslessly optimised in git? If so, please accept pull request #818.

@westnordost
Copy link
Member

westnordost commented Jan 31, 2018

You can surely delete inkscape:export-filename and other properties you think are privacy concerns and create a PR for that. I do not mind that paths to my user folder are in there, though.
Otherwise, see rugk

@stefanb
Copy link
Contributor

stefanb commented Jan 31, 2018

Based on difference between pull requests #817 and #818 there is roughly 300kB in .svg files that could be optimized. Since .svg files are xml they compress very well (compared to .jpg and .png format) making their impact on the .apk file size smaller (estimating 30-100kB).

@westnordost
Copy link
Member

The svgs are not included in the APK.

@stefanb
Copy link
Contributor

stefanb commented Jan 31, 2018

:-) well then it really depends where they are used and if size matters there.

@rugk
Copy link
Contributor

rugk commented Feb 1, 2018

They are used for designing the quest icons, e.g. That's the whole reason, why we should not optimize them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants