Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vindolin/_temp_
https://github.com/vindolin/_temp_
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/vindolin/_temp_
- Owner: vindolin
- License: mit
- Created: 2014-05-09T18:19:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-09T18:59:34.000Z (over 10 years ago)
- Last Synced: 2024-11-11T10:51:07.412Z (about 2 months ago)
- Size: 125 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Slice Android style 9-patch images into tiles and resize them into a scaled version
------------.. image:: https://travis-ci.org/vindolin/ninepatch.svg?branch=master
:width: 90
:alt: Travis CI
:target: https://travis-ci.org/vindolin/ninepatchsee https://developer.android.com/tools/help/draw9patch.html
Python usage
------------.. code-block:: python
from ninepatch import Ninepatch
ninepatch = Ninepatch('9patch_test.png')
scaled_image = ninepatch.render(500, 400) # creates a new PIL imageCommand line usage
------------------Your image must be a png image with a transparent background. The scale
guide color must be 100% opaque black.open the scaled image in a viewer
::
$ ninepatch 9patch_test.png 300 300
save the scaled image to a new file
::
$ ninepatch 9patch_test.png 300 300 scaled.png
Notes
-----You can see the module in action in the ninepatch\_actor.py from my
Clutter example project:
https://github.com/vindolin/Clutter-Python-examplesIssues
------TODO
----Validate Image and show user errors
Parse fill area guidesSee the example/unittest image:
.. image:: https://raw.githubusercontent.com/vindolin/ninepatch/master/ninepatch/test/ninepatch_bubble.png
:width: 320
:alt: Example image
:target: https://raw.githubusercontent.com/vindolin/ninepatch/master/ninepatch/test/ninepatch_bubble.pngOnly the scalable guides are used, fill area guides are ignored.