GithubHelp home page GithubHelp logo

agrajaghh / android-res-utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sebkur/android-res-utils

0.0 2.0 0.0 149 KB

Utils for working on android project res directories

Python 100.00%

android-res-utils's Introduction

Creating PNGs from SVG resource

These python scripts take as input an SVG image, replace paths with a specified color and opacity, scale it to a specified DP size and create crunched PNG images from that for the different sizes needed in the drawable-* directories of an Android project.

Usage from the command line

Call this to generate a number of PNG files in the res/drawable-* directories of your Android project from a SVG image:

pngs_from_svg.py <svg file> <res dir> <independent pixel size>
                 [--color <color>] [--opacity <opacity>] [--suffix <suffix>] [--nopngcrush]

or use the help command to display a list of options:

pngs_from_svg.py --help

Example usage:

pngs_from_svg.py path_to_my/image.svg path_to_my_project/res 32
--color "#000" --opacity 0.54 --suffix _light

pngs_from_svg.py path_to_my/image.svg path_to_my_project/res 32
--color "#fff" --opacity 1.0 --suffix _dark

Usage from within python scripts

Make sure to update your PYTHON_PATH variable:

export PYTHONPATH=$PYTHONPATH:/path_to/android-res-utils

Import the module:

import pngs_from_svg as pfs

Then call the function:

pfs.create_images(svg, res, dest, suffix, isize, color, opacity)

Examples

There are some examples in the 'examples' subdirectory that demonstrate the capabilities of this script. Use the script 'actionbar.py' to generate some beautiful ActionBar icons directly from svg files (including some icons from the Material repository).

android-res-utils's People

Contributors

agrajaghh avatar sebkur avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.