<commit_before>android-asset-resizer
=====================

The Android asset resizer can be used to generate drawable assets from a larger
source image, like an iOS ``@2x`` asset or an ``xhdpi`` drawable.

The script will generate the expected ``mdpi``, ``hdpi``, ``xhdpi`` and
``xxhdpi`` assets from the source image.

Requirements
------------

- PIL (tested with version ``1.1.7``, may work with earlier versions)

Installing
----------

::

    $ pip install android-asset-resizer

Examples
--------

You can easily generate Android assets from your ``@2x`` iOS assets:

::

    $ aaresize assets/icon@2x.png

Running this command will generate the following assets:

::

    - res
      - drawable-mdpi
        - icon.png
      - drawable-hdpi
        - icon.png
      - drawable-xhdpi
        - icon.png
      - drawable-xxhdpi
        - icon.png

These assets were created from the original ``@2x`` asset where the icon in
the ``drawable-xhdpi`` folder is just a copy of the original.

You can also resize an entire directory of images:

::

    $ aaresize assets/*@2x.png

An Android ``xhdpi`` asset is roughly equivalent to an ``@2x`` asset, so you
can easily resize those too:

::

    $ aaresize res/drawable-xhdpi/*.png

If you have a large ``drawable-xxhdpi`` asset you can use the ``--density``
flag to generate the smaller assets:

::

    $ aaresize res/drawable-xxhdpi/*.png --density=xxhdpi

You can also easily add a prefix to your new assets:

::

    $ aaresize assets/*@2x.png --prefix=ic_

Use the ``--ldpi`` flag to generate low density assets:

::

    $ aaresize res/drawable-xhdpi/*.png --ldpi

Use the ``--exclude`` flag to specify a list of files that should not be
resized:

::

    $ aaresize res/drawable-xhdpi/*.png --exclude=ic_launcher.png,ic_status.png

You can also import the ``AssetResizer`` class and incorporate it into your
own scripts:

::

    from PIL import Image
    from android_asset_resizer.resizer import AssetResizer

    # Create our resizer
    resizer = AssetResizer(out_dir, source_density='xhdpi',
        prefix='ic_', image_filter=Image.ANTIALIAS)

    # Make our resource directories
    resizer.mkres()

    # Resize an image
    resizer.resize(path)

Publishing
----------

::

    # Register with pypi (only done once)
    $ python setup.py register

    # Upload a new source distribution to pypi
    $ python setup.py sdist upload

Bug reports
-----------

If you encounter any issues, please open a new issue on the project's
`GitHub page`_.

License
-------

See the LICENSE_ file.

.. _LICENSE: https://github.com/twaddington/android-asset-resizer/blob/master/LICENSE 
.. _GitHub page: https://github.com/twaddington/android-asset-resizer<commit_msg>Update README with supporting info.<commit_after>android-asset-resizer
=====================

The Android asset resizer can be used to generate drawable assets from a larger
source image, like an iOS ``@2x`` asset or an ``xhdpi`` drawable.

The script will generate the expected ``mdpi``, ``hdpi``, ``xhdpi`` and
``xxhdpi`` assets from the source image.

If you like this library and it's saved you some time, please consider
supporting further development with a `Gittip donation`_!

Requirements
------------

- PIL (tested with version ``1.1.7``, may work with earlier versions)

Installing
----------

::

    $ pip install android-asset-resizer

Examples
--------

You can easily generate Android assets from your ``@2x`` iOS assets:

::

    $ aaresize assets/icon@2x.png

Running this command will generate the following assets:

::

    - res
      - drawable-mdpi
        - icon.png
      - drawable-hdpi
        - icon.png
      - drawable-xhdpi
        - icon.png
      - drawable-xxhdpi
        - icon.png

These assets were created from the original ``@2x`` asset where the icon in
the ``drawable-xhdpi`` folder is just a copy of the original.

You can also resize an entire directory of images:

::

    $ aaresize assets/*@2x.png

An Android ``xhdpi`` asset is roughly equivalent to an ``@2x`` asset, so you
can easily resize those too:

::

    $ aaresize res/drawable-xhdpi/*.png

If you have a large ``drawable-xxhdpi`` asset you can use the ``--density``
flag to generate the smaller assets:

::

    $ aaresize res/drawable-xxhdpi/*.png --density=xxhdpi

You can also easily add a prefix to your new assets:

::

    $ aaresize assets/*@2x.png --prefix=ic_

Use the ``--ldpi`` flag to generate low density assets:

::

    $ aaresize res/drawable-xhdpi/*.png --ldpi

Use the ``--exclude`` flag to specify a list of files that should not be
resized:

::

    $ aaresize res/drawable-xhdpi/*.png --exclude=ic_launcher.png,ic_status.png

You can also import the ``AssetResizer`` class and incorporate it into your
own scripts:

::

    from PIL import Image
    from android_asset_resizer.resizer import AssetResizer

    # Create our resizer
    resizer = AssetResizer(out_dir, source_density='xhdpi',
        prefix='ic_', image_filter=Image.ANTIALIAS)

    # Make our resource directories
    resizer.mkres()

    # Resize an image
    resizer.resize(path)

Publishing
----------

::

    # Register with pypi (only done once)
    $ python setup.py register

    # Upload a new source distribution to pypi
    $ python setup.py sdist upload

Bug reports
-----------

If you encounter any issues, please open a new issue on the project's
`GitHub page`_.

License
-------

See the LICENSE_ file.

.. _Gittip donation: https://www.gittip.com/twaddington/
.. _LICENSE: https://github.com/twaddington/android-asset-resizer/blob/master/LICENSE 
.. _GitHub page: https://github.com/twaddington/android-asset-resizer
{'fraction_non_alphanumeric': 0.12431379493536392, 'fraction_numerical': 0.003541703559412077, 'mean_word_length': 2.9802677942212825, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3244023', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1719, 'n_words': 614}