Skip to main content

A toolkit for reading and generating Paintman related files for color management.

Project description

PaintmanToolkit

PaintmanToolkit is a comprehensive Python module designed for managing Paintman CCF (Color Chart File) and CRF (Color Replace File) formats, essential for color chart and replacement management in animation production. The toolkit supports reading and generating files with both 8-bit and 16-bit RGB(only for CCFReader) color depths.

Installation

To install PaintmanToolkit, use pip:

pip install PaintmanToolkit

Usage

Importing the Module

from PaintmanToolkit import CCFGenerator, CCFReader, CRFReader, CRFGenerator, RGB8, RGB16

Working with CCF Files

Creating a CCF File

Use CCFGenerator to create a CCF file:

color_data = [
    ((255, 0, 0), "Red"),
    ((0, 255, 0), "Green"),
    ((0, 0, 255), "Blue峠"),  # Example with Japanese characters
    ((0, 0, 0), "黑色辻"),  # Example with Chinese characters
    ((255, 255, 255), "White白色"),  # Example with mixed characters
    ((128, 128, 128), "Gray灰色"),
    ((255, 255, 0), "Yellow"),
    ((0, 255, 255), "Cyanシアン"),  # Japanese characters
    ((255, 0, 255), "Magenta")
]

generator = CCFGenerator(color_data)
generator.create_ccf_file("output_file.ccf")
print("CCF file created successfully at 'output_file.ccf'")

Reading a CCF File

Use CCFReader to read a CCF file:

reader = CCFReader("output_file.ccf")

# Reading with 8-bit RGB
color_data_8bit = reader.read_ccf_file(RGB8)
print("8-bit RGB Color Data:")
for label, rgb in color_data_8bit:
    print(f"Label: {label}, RGB: {rgb}")

# Reading with 16-bit RGB
color_data_16bit = reader.read_ccf_file(RGB16)
print("\n16-bit RGB Color Data:")
for label, rgb in color_data_16bit:
    print(f"Label: {label}, RGB: {rgb}")

Working with CRF Files

Reading a CRF File

Use CRFReader to read a CRF file:

reader = CRFReader()
color_pairs = reader.read_crf_file("input_file.crf")
print("CRF Color Pairs:")
for color1, color2 in color_pairs:
    print(f"Color 1: {color1}, Color 2: {color2}")

Creating a CRF File

Use CRFGenerator to generate a CRF file:

color_pairs = [
    [(0, 0, 0), (205, 246, 225)],
    [(40, 38, 37), (10, 16, 36)],
    # Add more color pairs as needed
]

generator = CRFGenerator()
generator.generate_crf_file(color_pairs, "output_file.crf")
print("CRF file created successfully at 'output_file.crf'")

Constants

  • RGB8: Constant for 8-bit RGB color depth.
  • RGB16: Constant for 16-bit RGB color depth.

Exception Handling

  • CCFGenerator raises a ValueError if any RGB value exceeds 255, ensuring values are valid 8-bit RGB before encoding.
  • CRFGenerator raises a ValueError if the color pairs list is empty or exceeds 256 pairs.

Important Notes

  • CCF Files: CCFGenerator currently does not support 16-bit RGB or RGBA encoding.
  • CRF Files: CRFGenerator ensures a maximum of 256 color pairs and fills with white pairs if the count is less than 123.

License

This project is licensed under the MIT License.


Contributing

Contributions are welcome! Please submit a pull request or open an issue to suggest improvements or report bugs.


Contact

For questions or support, feel free to submit a pull request or open an issue.

Enjoy using PaintmanToolkit for your color chart and color replacement management in animation projects!

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

paintman_toolkit-1.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Paintman_Toolkit-1.0.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: paintman_toolkit-1.0.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for paintman_toolkit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ce61c0fd9bb07213ef9caf5fb86247580c52868d94caaaa5e345f1ce7407f9ef
MD5 d398f9c1a9ae1bbd035a46179ad02bea
BLAKE2b-256 c204ba7f489dff387aa89481012a88a8854b9804dbdab8186279fcdfc957dbfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Paintman_Toolkit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd88df5f82f70baf162cb0233913d08b8fabd4c8c026d8425c47eabb11826e31
MD5 f8fe31f299031b6ae362e9129cb26101
BLAKE2b-256 22f0199b8662fd0f4be4edb2dd56279ea058657b424f72333471500e08efda78

See more details on using hashes here.

Supported by

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