Skip to main content

This is helper package for game called 'Colouring art.

Project description

Pickart

[!NOTE] Цей документ має переклад українською.

Pickart - this is the file format used by the game called Colouring art for storing images.

Name 'Pickart' - comes from a combination of two words 'pickle' and 'art'.

About format

The root of the .pickart file is a Python dictionary serialised with pickle and compressed with gzip.

File structure (version 1.0.0):

{
    "info":{
        "size": (1, 1),
        "version": 1
    },
    "palette":[(red, green, blue, alpha), ...],
    "pixels": [
        [(colour_index, is_painted), ...]
    ]
}

"info" - stores image size and Pickart file version.

"palette" - stores colour palette. Every colour is a tuple of integers. Integer value is in range from 0 to 255 (including), alpha - optional.

"pixels" - stores a matrix which contains a tuple with colour_index(int) and flag painted(bool).

colour_index - colour index in palette if this pixel is transparent (alpha = 0), index becomes None.

painted - represents pixel state, if false it will appear as a shade of grey, otherwise like normal colour.

Package pickle has security issues. The game does not use standard pickle.load() instead it uses restricted loader which allows only basic types(int, str, list, dict, tuple, set). If it detects that the file contains external types (any object that is imported), it will throw the exception UnpicklingError with the message There is something strange in the file, do not trust it!.

Command line interface

This package allows converting .png files to .pickart and vice versa.

The command below shows all arguments:

Windows:

python -m pickart -h

For Linux and macOS

python3 -m pickart -h

Basic arguments

-i "path" - indicates the folder in which the files for conversion are located (by default, 'input'). The folder must exist.

-o "path" - indicates the folder in which converted files will be stored (by default, 'output'). May not exist.

-m "mode" - indicates conversion mode:

  • to_pickart - .png files to .pickart files.
  • to_png - .pickart files to .png files.

Tests

All tests are written using the unittest module. To run use the command:

Windows:

python -m unittest discover

For Linux and macOS

python3 -m unittest discover

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

pickart-2.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

pickart-2.0.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file pickart-2.0.0.tar.gz.

File metadata

  • Download URL: pickart-2.0.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for pickart-2.0.0.tar.gz
Algorithm Hash digest
SHA256 01b56f60395c1c65f592ebf28c995b9ea0f812b88d0021995bc286b9bc3c4f35
MD5 55c7c01606f8b006e934730b3e693ce3
BLAKE2b-256 fd608c2782376a8bdf5b08a62b630d5ed0b25c6dca0b7617e488f8deee865131

See more details on using hashes here.

File details

Details for the file pickart-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pickart-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for pickart-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20853cab6710433ae0ccef4218b9534df4ac95f8f22bff9bc23ea147f926b136
MD5 380bbe5d3198cb8d82ee55389c82bb8a
BLAKE2b-256 802b0d2edec440479788188e6a52be26070391a4019faf88eef89648a90af0f8

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