Giter Club home page Giter Club logo

android-vector-rasterizer's Introduction

android-vector-rasterizer Build

A command-line tool to generate WebP images from SVG files for the multiple Android pixel densities.

Java 11 or later is required to run this tool.

Usage

Usage information can be obtained by passing the --help / -h option:

java -jar android-vector-rasterizer.jar [<options>] <source>...

Density options:

  You can enable or disable generation of a version for a specific pixel
  density by specifying one or more of the options below.

  --ldpi / --no-ldpi        (default: not generated)
  --mdpi / --no-mdpi        (default: generated)
  --hdpi / --no-hdpi        (default: generated)
  --xhdpi / --no-xhdpi      (default: generated)
  --xxhdpi / --no-xxhdpi    (default: generated)
  --xxxhdpi / --no-xxxhdpi  (default: generated)

Dimension options:

  The desired width and height (in density-independent pixels) of the generated
  images can be set via the options below.
  If not set explicitly, the size will be determined by the 'width' and
  'height' attributes of the 'svg' element, or by the 'viewBox' attribute if
  these are not set.
  If only one of the two is set, then the other one will be computed with
  respect to the original aspect ratio.

  --width=<int>   Width in dp.
  --height=<int>  Height in dp.

Options:
  -d, --destination=<dir>  Location of the generated WebP files
                           (must be a directory).
  --force-transparent-white  Convert transparent black (#00000000) pixels
                             to transparent white pixels (#00FFFFFF).

Examples:

  • Rasterize vector.svg and generate WebP versions for all densities (all except ldpi are implied if not explicitly unset):
    java -jar android-vector-rasterizer.jar --ldpi vector.svg

  • Set a target width of 256 density-independent pixels (while preserving the aspect ratio):
    java -jar android-vector-rasterizer.jar --width=256 vector.svg

  • Specify the location of the generated files:
    java -jar android-vector-rasterizer.jar -d generated/ vector1.svg vector2.svg vector3.svg

android-vector-rasterizer's People

Contributors

amarland avatar

Watchers

 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.