Metadata-Version: 2.4
Name: azurpaint
Version: 1.0.2
Summary: Azur Lane painting reconstructor/extractor.
Author-email: Fernando <81207411+Fernando2603@users.noreply.github.com>
License: MIT License
        
        Copyright (c) 2024 Fernando
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Fernando2603/azurpaint
Project-URL: Bug Tracker, https://github.com/Fernando2603/azurpaint/issues
Keywords: python,unity,azurlane,azur-lane,extractor
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Pillow
Requires-Dist: UnityPy==1.10.18
Dynamic: license-file
Dynamic: requires-python

# azurpaint

[![PyPI supported Python versions](https://img.shields.io/pypi/pyversions/azurpaint.svg)](https://pypi.python.org/pypi/azurpaint)
[![MIT](https://img.shields.io/github/license/Fernando2603/azurpaint)](https://github.com/Fernando2603/azurpaint/blob/main/LICENSE)


Azur Lane painting reconstructor/extractor.

## Install
**Python 3.9.0 or higher is required**
```cmd
pip install azurpaint
```

## Usage

Simple example to extract painting

- create new folder
- get and extract `/Android/obb/com.YoStarEN.AzurLane/*.obb` to new folder
- copy `AssetBundles` from `/Android/data/com.YoStarEN.AzurLane/files/AssetBundles`

> [!NOTE]
> only `painting`, `paintings` and `paintingface` folder are required from `AssetBundles`.


```Python
from pathlib import Path
from azurpaint import Azurpaint
from azurpaint.exception import PrefabNotFound

# extract painting with default expression/face
def extract(asset_bundle_path, prefab_path):
  try:
    azurpaint = Azurpaint(asset_bundle_path, prefab_path)

    # search dependencies automatically within AssetBundles (root)
    # this is still in experimental mode so far on testing the result is good
    # load_dependencies only searching in local file and it doesn't know
    # if there any missing dependency it doesn't know what file it is
    # so you should provide complete asset include extracted OBB before running this
    azurpaint.load_dependencies()

    # PIL.Image.Image
    return azurpaint.create()
  except PrefabNotFound:
    print(f"{prefab_path} is not an prefab.")


# extract painting with all face/expression into output_dir
def extract_all_face(asset_bundle_path, prefab_path, output_dir):
  try:
    azurpaint = Azurpaint(asset_bundle_path, prefab_path)
    azurpaint.load_dependencies()

    Path(output_dir).mkdir(parents=True, exist_ok=True)
    azurpaint.create().save(Path(output_dir, f"{azurpaint.prefab.name}-default.png"))

    for face in azurpaint.face_list:
      azurpaint.change_face(face)
      azurpaint.create().save(Path(output_dir, f"{azurpaint.prefab.name}-{face}.png"))

  except PrefabNotFound:
    print(f"{prefab_path} is not an prefab.")


if __name__ == '__main__':
  # azurpaint require asset that have .prefab
  # will raise PrefabNotFound if file is not an prefab
  extract('path_to/AssetBundles', 'painting/tashigan')
```
