pool
Pool
Bases: Palette
Source code in phomo/pool.py
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
pixels: np.ndarray
property
Array containing the 3-channel pixel values of all the images in the Pool.
tiles: PoolTiles
property
Access the Pool's tile images.
Examples:
Show the first image in the pool.
>>> pool.tiles[0].show()
__init__(array)
A Pool
of tile images, to use in contructing the photo mosaic.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array |
ArrayLike
|
|
required |
Source code in phomo/pool.py
68 69 70 71 72 73 74 75 76 77 |
|
from_dir(tile_dir, crop_ratio=None, tile_size=None, mode=None)
classmethod
Create a Pool
instance from the images in a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tile_dir |
PathLike
|
path to directory containing the images. |
required |
crop_ratio |
Optional[float]
|
width to height ratio to crop the tile images to. 1 results in a square image. |
None
|
tile_size |
Optional[Tuple[int, int]]
|
resize the image to the provided size, width followed by height. |
None
|
mode |
Optional[str]
|
convert the images to the provided mode. See PIL Modes. |
None
|
Source code in phomo/pool.py
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 |
|
from_files(files, crop_ratio=None, tile_size=None, mode=None)
classmethod
Create a Pool
instance from a list of images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files |
Sequence[PathLike]
|
list of paths to the tile images. |
required |
crop_ratio |
Optional[float]
|
width to height ratio to crop the master image to. 1 results in a square image. |
None
|
tile_size |
Optional[Tuple[int, int]]
|
resize the image to the provided size, width followed by height. |
None
|
mode |
Optional[str]
|
mode the image to the provided mode. See PIL Modes. |
None
|
Source code in phomo/pool.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
PoolTiles
Helper interface to access of PIL.Image
instances of the tiles.
Source code in phomo/pool.py
115 116 117 118 119 120 121 122 |
|