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

Resize vectors to a max size #20

Open
PaulWoitaschek opened this issue Dec 21, 2017 · 4 comments
Open

Resize vectors to a max size #20

PaulWoitaschek opened this issue Dec 21, 2017 · 4 comments

Comments

@PaulWoitaschek
Copy link

In https://medium.com/upday-devs/optimizing-the-performance-of-vector-drawables-680a4c456286
it's recommended to only use vectors with a maximum size of 200dp.

I suggest to have an optional flag to resize the xml files to that size (maybe passing the desired max dp) while maintaining the aspect ratio.

@alexjlockwood
Copy link
Owner

Will consider it! Sounds like a useful feature, although I am questioning whether it is outside the scope of the project (originally avdo was basically meant to be a slimmed down version of "svgo" except for vector drawables instead... svgo does provide some disabled-by-default-plugins that are not related to optimization... things like sorting attributes, adding prefixes to class names, etc... so maybe avdo could support custom plugins like that).

At some point I want to make it possible for people to write their own custom plugins and have them be specified via command line, so I'll keep this in mind when I start thinking about how that would work!

@dabitdev
Copy link

@PaulWoitaschek did you find a way to optimize the vectors to 200dp?
the medium post is not working anymore. I am wondering if that 200dp make sense for all cases. In my case I am using a vectorDrawable as background of the root view using all the screen.

@PaulWoitaschek
Copy link
Author

Yes, you can just manually set the width to 200dp (and adjust the height by the appropriate factor).

However if the target is actually larger than 200dp you should simply not use a vector drawable but a webp image.

But it depends on the image - if it has a large padding you should remove it from the vector and set it on the view directly and then you can continue using the vector drawable.

@dabitdev
Copy link

my target will be more than 200dp :( it is a full screen background.
I wanted to prevent using different densities like before.

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

No branches or pull requests

3 participants