Settings
Crop
dataclass
Crop a rectangular region from an image.
Usage:
# crop an image using coords
crop = Crop(Coord(10, 10, 50, 50))
Source code in nucleus/sdk/processing/image/settings.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
Thumbnail
dataclass
Resize the image into a thumbnail.
Usage:
# thumbnail size 50x50 pixels
thumb = Thumbnail(50, 50)
Source code in nucleus/sdk/processing/image/settings.py
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 |
|
Resize
dataclass
Resize the image to a given size.
Usage:
# new image size 100x100
resize = Resize(100, 100)
Source code in nucleus/sdk/processing/image/settings.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
Coordinate System
"The Python Imaging Library uses a Cartesian pixel coordinate system, with (0,0) in the upper left corner. Note that the coordinates refer to the implied pixel corners; the centre of a pixel addressed as (0, 0) actually lies at (0.5, 0.5)." - pillow
Coord
dataclass
Represents a cartesian pixel coordinate.
Usage:
# two points in the cartesian plane: top + left, right + bottom
coord = Coord(10, 10, 50, 50) # left, top, right, bottom coordinates
Source code in nucleus/sdk/processing/image/settings.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
Note
During processing time, the setting classes are parsed as a method to dynamically call pillow image object. To know more about the settings implemented in this reference please see pillow docs.