master
Master
Bases: Palette
Source code in phomo/master.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
img
property
PIL.Image
of the master image.
pixels: np.ndarray
property
Array containing the 3-channel pixel values of the master image.
__init__(array)
The master image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array |
ndarray
|
numpy array of the image, should contain 3 channels. |
required |
Returns:
Type | Description |
---|---|
None
|
Master image instance. |
Source code in phomo/master.py
60 61 62 63 64 65 66 67 68 69 |
|
from_file(master_image_file, crop_ratio=None, img_size=None, mode=None)
classmethod
Create a master image from file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
master_image_file |
PathLike
|
path to image file. |
required |
crop_ratio |
Optional[float]
|
width to height ratio to crop the master image to. 1 results in a square image. |
None
|
img_size |
Optional[Tuple[int, int]]
|
resize the image to the provided size, width followed by height. |
None
|
mode |
Optional[str]
|
convert the image to the provided mode. See PIL Modes. |
None
|
Returns:
Type | Description |
---|---|
Master
|
Master image instance. |
Examples:
For black and white square 1280x1280 image.
>>> Master.from_file("master.png", crop_ratio=1, img_size=(1280, 1280), convert="L")
Source code in phomo/master.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
from_image(master_image)
classmethod
Create a master image from PIL.Image.Image
Parameters:
Name | Type | Description | Default |
---|---|---|---|
master_image |
Image
|
|
required |
Returns:
Type | Description |
---|---|
Master
|
Master image instance. |
Source code in phomo/master.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|