Image Processing¶
This tutorial explains how images can be handled and transformed with the Image class.
Note
All operations on an Image return a new Image. The original Image will not be changed.
Load data into an Image:¶
Process the image¶
- Resize the
Imageto have the width 284 and height 160:
- Convert the
Imageto grayscale:
- Crop the
Imageto be 200x200 with the top-left corner being at (255, 30):
- Flip the
Imagehorizontally (or vertically):
- Adjust the brightness of the
Image.
Giving a factor below 1 will result in a darker Image, a factor above 1 will return a brighter Image.
- Adjust the contrast of the
Image.
Giving a factor below 1 will decrease the contrast of the Image, a factor above 1 will increase the contrast of the Image.
- Adjust the color balance of the
Image.
A factor of 0 will return a black and white Image, a factor of 1 will return a copy of the original Image.
- Blur the
Image:
The higher the radius, the blurrier the Image gets.
The radius defines the amount of pixels combined in each direction.
- Sharpen the
Image:
The factor defines the sharpness of the returned Image.
- Invert the colors of the
Image:
- Rotate the
Imageto the right (or the left):
- Convert the
Imageto grayscale and highlight the edges:
- Add noise to the
Image. A higherstandard_deviationwill result in a noisierImage: