Module Expr Str Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias ImportFrom alias alias ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr BoolOpOr AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore BinOpAdd SubscriptLoad Call AttributeLoad Call NameLoad AttributeLoad NameLoad attr attr Str Num Index Num Str Return Call NameLoad AttributeLoad NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam NameParam defaults body AugAssignSub NameStore Num AugAssignBitOr NameStore BinOpRShift NameLoad Num AugAssignBitOr NameStore BinOpRShift NameLoad Num AugAssignBitOr NameStore BinOpRShift NameLoad Num AugAssignBitOr NameStore BinOpRShift NameLoad Num AugAssignBitOr NameStore BinOpRShift NameLoad Num Return BinOpAdd NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Print Call AttributeLoad Str attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad Call NameLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Assign NameStore Dict Str Str Str Str Str Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num keyword TupleLoad Str Str Assign NameStore Call AttributeLoad NameLoad attr Str Str With Call NameLoad AttributeLoad NameLoad attr Str NameStore body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call NameLoad Str Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Print Call AttributeLoad Str attr AttributeLoad NameLoad attr Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword ListLoad Str Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr Str body Expr Call AttributeLoad Call NameLoad NameLoad attr orelse If CompareEq AttributeLoad NameLoad attr Str body Expr Call AttributeLoad Call NameLoad NameLoad attr orelse Print Str Expr Call NameLoad Num decorator_list NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Str Str AugAssignAdd NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Str For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad Str If UnaryOpNot Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Str Str If UnaryOpNot Call NameLoad NameLoad body Continue Print Call AttributeLoad Str attr NameLoad Assign AttributeStore NameLoad attr NameLoad Return If CompareIs AttributeLoad NameLoad attr NameLoad body Print Str Expr Call NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Print Call AttributeLoad Str attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Call AttributeLoad Str attr NameLoad NameLoad Assign NameStore BinOpAdd AttributeLoad NameLoad attr Str Assign NameStore ListLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Str NameLoad TryFinally body Expr Call AttributeLoad NameLoad attr NameLoad With Call NameLoad NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr finalbody If Call NameLoad NameLoad body Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str TupleLoad NameLoad NameLoad TupleLoad NameLoad NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Str Str AugAssignAdd NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Str For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad Str If UnaryOpNot Call NameLoad NameLoad body Continue Print Call AttributeLoad Str attr NameLoad Assign AttributeStore NameLoad attr NameLoad Return Print Str Expr Call NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Print Call AttributeLoad Str attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Print Call AttributeLoad Str attr NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Print Call AttributeLoad Str attr NameLoad Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Num Index Num Assign NameStore Call AttributeLoad Str attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpAdd AttributeLoad NameLoad attr Str Assign NameStore ListLoad AttributeLoad NameLoad attr If AttributeLoad AttributeLoad NameLoad attr attr body AugAssignAdd NameStore ListLoad Str AugAssignAdd NameStore ListLoad Str Str Str NameLoad Str Str NameLoad TryFinally body Expr Call AttributeLoad NameLoad attr NameLoad With Call NameLoad NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr finalbody If Call NameLoad NameLoad body Expr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str TupleLoad NameLoad NameLoad TupleLoad NameLoad NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr
N/A N/A 
Texture compression tool
========================

This tool is designed to compress images into:

- PVRTC (PowerVR Texture Compression), mostly iOS devices
- ETC1 (Ericson compression), working on all GLES2/Android devices

Usage
-----

In order to compress a texture::

    texturecompress.py [--dir <directory>] <format> <image.png>

This will create a `image.tex` file with a json header that contains all the
image information and the compressed data.

TODO
----

Support more format, such as:

- S3TC (already supported in Kivy)
- DXT1 (already supported in Kivy)
 N/A json struct pack pprint pprint subprocess Popen PIL Image argparse ArgumentParser sys exit os.path join exists dirname basename os environ unlink Tool N/A object N/A __init__ N/A N/A self options N/A N/A N/A N/A N/A N/A super Tool self __init__ N/A N/A self options options N/A N/A self source_fn N/A options image N/A N/A self dest_dir N/A N/A options dir N/A dirname N/A options image N/A tex_fn N/A N/A self N/A N/A N/A fn N/A N/A N/A N/A N/A basename N/A self source_fn rsplit . 1 N/A 0 .tex N/A N/A join N/A self dest_dir fn N/A property compress N/A N/A self N/A N/A N/A N/A nearest_pow2 N/A N/A self v N/A N/A N/A v 1 N/A v N/A v 1 N/A v N/A v 2 N/A v N/A v 4 N/A v N/A v 8 N/A v N/A v 16 N/A N/A v 1 N/A runcmd N/A N/A self cmd N/A N/A N/A N/A N/A Run: {} format N/A N/A join cmd N/A N/A N/A N/A Popen cmd communicate N/A write_tex N/A N/A self data fmt image_size texture_size mipmap formatinfo N/A False None N/A N/A infos N/A datalen image_size texture_size mipmap format N/A len data image_size texture_size mipmap fmt N/A formatinfo N/A N/A N/A infos N/A formatinfo formatinfo N/A header N/A N/A json dumps infos indent 0 separators N/A , : N/A header N/A N/A header replace N/A N/A open N/A self tex_fn wb fd N/A N/A N/A N/A fd write KTEX N/A N/A N/A fd write N/A pack I N/A len header N/A N/A N/A fd write header N/A N/A N/A fd write data N/A N/A N/A Done! Compressed texture written at {} format N/A self tex_fn N/A N/A pprint infos N/A run N/A N/A N/A N/A N/A parser N/A ArgumentParser description Convert images to compressed texture N/A N/A N/A parser add_argument --mipmap type bool default False help Auto generate mipmaps N/A N/A N/A parser add_argument --dir type str default None help Output directory to generate the compressed texture N/A N/A N/A parser add_argument format type str choices N/A pvrtc etc1 help Format of the final texture N/A N/A N/A parser add_argument image type str help Image filename N/A args N/A N/A parser parse_args N/A N/A N/A args format pvrtc N/A N/A N/A N/A N/A PvrtcTool args compress N/A N/A N/A N/A args format etc1 N/A N/A N/A N/A N/A Etc1Tool args compress N/A N/A Unknown compression format N/A N/A exit 1 N/A staticmethod N/A Etc1Tool N/A Tool N/A __init__ N/A N/A self options N/A N/A N/A N/A N/A N/A super Etc1Tool self __init__ options N/A N/A self etc1tool None N/A N/A N/A self locate_etc1tool N/A locate_etc1tool N/A N/A self N/A N/A N/A search_directories N/A N/A N/A environ get ANDROIDSDK / N/A search_directories N/A N/A N/A N/A environ get PATH split : N/A directory search_directories N/A N/A fn N/A join directory etc1tool N/A N/A N/A exists fn N/A N/A fn N/A join directory tools etc1tool N/A N/A N/A exists fn N/A N/A N/A N/A N/A Found texturetool at {} format directory N/A N/A self etc1tool fn N/A N/A N/A N/A self etc1tool None N/A N/A Error: Unable to locate "etc1tool".
Make sure that "etc1tool" is available in your PATH.
Or export the path of your Android SDK to ANDROIDSDK N/A N/A exit 1 N/A compress N/A N/A self N/A N/A N/A image N/A N/A Image open N/A self source_fn N/A N/A w h N/A image size N/A N/A N/A Image size is {}x{} format N/A image size N/A w2 N/A N/A self nearest_pow2 w N/A h2 N/A N/A self nearest_pow2 h N/A N/A N/A Nearest power-of-2 size is {}x{} format w2 h2 N/A raw_tex_fn N/A N/A self tex_fn .raw N/A cmd N/A N/A self etc1tool N/A self source_fn --encodeNoHeader -o raw_tex_fn N/A N/A N/A N/A N/A self runcmd cmd N/A N/A open raw_tex_fn rb fd N/A N/A data N/A N/A fd read N/A N/A N/A exists raw_tex_fn N/A N/A N/A unlink raw_tex_fn N/A N/A N/A self write_tex data etc1_rgb8 N/A w h N/A w2 h2 N/A N/A self options mipmap N/A N/A PvrtcTool N/A Tool N/A __init__ N/A N/A self options N/A N/A N/A N/A N/A N/A super PvrtcTool self __init__ options N/A N/A self texturetool None N/A N/A N/A self locate_texturetool N/A locate_texturetool N/A N/A self N/A N/A N/A search_directories N/A /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ N/A search_directories N/A N/A N/A N/A environ get PATH split : N/A directory search_directories N/A N/A fn N/A join directory texturetool N/A N/A N/A exists fn N/A N/A N/A N/A N/A Found texturetool at {} format directory N/A N/A self texturetool fn N/A N/A Error: Unable to locate "texturetool".
Please install the iPhone SDK, or the PowerVR SDK.
Then make sure that "texturetool" is available in your PATH. N/A N/A exit 1 N/A compress N/A N/A self N/A N/A N/A image N/A N/A Image open N/A self source_fn N/A N/A w h N/A image size N/A N/A N/A Image size is {}x{} format N/A image size N/A w2 N/A N/A self nearest_pow2 w N/A h2 N/A N/A self nearest_pow2 h N/A N/A N/A Nearest power-of-2 size is {}x{} format w2 h2 N/A s2 N/A max w2 h2 N/A N/A N/A PVR need a square image, the texture will be {0}x{0} format s2 N/A ext N/A N/A N/A N/A self source_fn rsplit . 1 N/A -1 N/A tmpfile N/A N/A /tmp/ktexturecompress.{} format ext N/A image N/A N/A image resize N/A s2 s2 N/A N/A N/A image save tmpfile N/A raw_tex_fn N/A N/A self tex_fn .raw N/A cmd N/A N/A self texturetool N/A N/A N/A self options mipmap N/A N/A cmd N/A -m N/A cmd N/A -e PVRTC -o raw_tex_fn -f RAW tmpfile N/A N/A N/A N/A N/A self runcmd cmd N/A N/A open raw_tex_fn rb fd N/A N/A data N/A N/A fd read N/A N/A N/A exists raw_tex_fn N/A N/A N/A unlink raw_tex_fn N/A N/A N/A self write_tex data pvrtc_rgba4 N/A w h N/A s2 s2 N/A N/A self options mipmap N/A N/A N/A N/A __name__ __main__ N/A N/A N/A N/A Tool run