Pickart - this is the file format used by the game calledColouring art for storing images.
Name 'Pickart' - comes from combination of two words 'pickle' and 'art'.
Root of .pickart file is Python dict serialized 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 tuple of integers. Integer value is in range from 0 to 255(including), alpha
- optional.
"pixels"
- stores matrix which contain 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 gray otherwise like normal colour.
Package pickle has security issues game does not use standart pickle.load() instead it uses restricted loader which allows only basic types(int, str, list, dict, tuple, set). If it detects that file contains external types(any object that is imported) it will throw exception UnpicklingError
with message There is something strange in the file, do not trust it!
.
This package allows convert .png files to .pickart and vise versa.
Command below shows all arguments:
Windows:
python -m pickart -h
For Linux and MacOS
python3 -m pickart -h
-i "path"
- indicates the folder in which the files for conversion are located(by default 'input'). 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.