Skip to main content

No project description provided

Project description

N64Tex-Python

An image converter for N64 image formats written in Python

Description

This library is a Python implementation of Isotarge's N64Tex Tool

The goal is to have an OS-agnostic tool for converting between N64 image formats, fill in the missing CI image formats, and have a Python-importable library to function with my DK64-Lib Project

Installation

This package can be installed from PyPi using pip

pip install --upgrade n64tex

Usage

The package can be used in one of two ways. Either with the bundle CLI tool, or through a Python script itself.

CLI

From Image

Convert from an RGBA image to RGBA5551

n64tex rgba_image.png rgba5551 -o rgba5551_image.png
# Produces rgba5551_image.png

Optionally, you can also write a raw bytes file

n64tex rgba_image.png rgba5551 -o rgba5551_image.png --write_bytes
# Produces rgba5551_image.png and rgba5551_image

Converting to a CI format will provide an accompanying palette file

From bytes

You can also give a byte-like file to convert to an image, but the format must be specified

Converting from RGBA5551 to RGBA

n64tex rgba5551_bytes rgba5551 rgba -o rgba_image.png
# Produces rgba_image.png

Converting from CI bytes requires a bytes-like palette to be provided

n64tex ci8_bytes ci8 rgba -o rgba_image.png --palette palette_ci8_bytes

Python

Open an image and convert it to other formats

from PIL import Image
from n64tex.formats import RGBAImage

image = Image.open('rgba_image.png')
rgba_image = RGBAImage.from_image(image)

rgba5551_image = rgba_image.to_rgba5551()
i8a_image = rgba_image.to_i8a()
ci8_image = rgba_image.to_ci8()

# Any of these objects can be saves to an image file using the .save() method
rgba5551_image.save('rgba5551_image.png')
i8a_image.save('i8a_image.png')
ci8_image.save('ci8_image.png')

Open a bytes-like image and convert it to other formats or save it as an image file

from n64tex.formats import RGBA5551Image, CI8Image

with open('rgba5551_bytes', 'rb') as fil:
    rgba5551_image = RGBA5551Image.from_bytes(fil.read(), width=32, height=32)
rgba5551_image.save('rgba5551_image.png')

# CI file formats require a palette
with open('ci8_bytes', 'rb') as fil, open('palette_ci8_bytes', 'rb') as palette_fil:
    ci8_image = CI8Image.from_bytes(fil.read(), width=32, height=32, palette_bytes=palette_fil.read())
ci8_image.save('ci8_image.png')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

n64tex-1.0.1.tar.gz (46.6 kB view details)

Uploaded Source

Built Distribution

n64tex-1.0.1-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file n64tex-1.0.1.tar.gz.

File metadata

  • Download URL: n64tex-1.0.1.tar.gz
  • Upload date:
  • Size: 46.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for n64tex-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c7ef6b94b9f17e4c0cdd15fb5850c30bce8c83d04eaefa725de32f4f19caa427
MD5 904d3129a3b2057bea95088a8fb1a722
BLAKE2b-256 8019994e4af581eb99036553fe246555a057ed84732050a927449d488ebdf015

See more details on using hashes here.

File details

Details for the file n64tex-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: n64tex-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 40.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for n64tex-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac76390380053df47067c41aea15e78db6b6fcf9a14eb06450a716daf1f3f66a
MD5 e71d19a3b10c62fff4ec202c531f0c21
BLAKE2b-256 8ddde6d10ff6926413852777360788fc4d3dad6eb146c056c29f66925af10654

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page