ImageList Processing¶
This tutorial explains how multiple images can be handled and transformed with the ImageList class.
Note
All operations on an ImageList return a new ImageList. The original ImageList will not be changed.
Load data into an ImageList:¶
- Load images via files in an
ImageList:
- Create an
ImageListfrom multipleImageobjects:
In [2]:
Copied!
from safeds.data.image.containers import Image
plane = Image.from_file("data/plane.png")
small_plane = Image.from_file("data/small_plane.png")
ImageList.from_images([plane, small_plane])
from safeds.data.image.containers import Image
plane = Image.from_file("data/plane.png")
small_plane = Image.from_file("data/small_plane.png")
ImageList.from_images([plane, small_plane])
Process the image¶
- Resize the images in the
ImageListto have the width 200 and height 200:
- Convert the images in the
ImageListto grayscale:
- Crop the images in the
ImageListto be 200x200 with the top-left corner being at (115, 30):
- Flip the images in the
ImageListhorizontally (or vertically):
- Adjust the brightness of the images in the
ImageList.
Giving a factor below 1 will result in darker images, a factor above 1 will return brighter images.
- Adjust the contrast of the images in the
ImageList.
Giving a factor below 1 will decrease the contrast of the images, a factor above 1 will increase the contrast of the images.
- Adjust the color balance of the images in the
ImageList.
A factor of 0 will return black and white images, a factor of 1 will return a copy of the original ImageList.
- Blur the images in the
ImageList:
The higher the radius, the blurrier the images get. The radius defines the amount of pixels combined in each direction.
- Sharpen the images in the
ImageList:
The factor defines the sharpness of the returned images.
- Invert the colors of the images in the
ImageList:
- Rotate the images in the
ImageListto the right (or the left):
- Convert the images in the
ImageListto grayscale and highlight the edges:
- Add noise to the images in the
ImageList. A higherstandard_deviationwill result in noisier images: