Transform¶
Crop¶
- crop the given image by the given window. begin point is at top-left and
- end point is at the lower-right of the image.
Example:
>>> # read an image
>>> source_image = Read('source.exr')
>>> # crop the source image
>>> crop(source_image, 0, 0, 500, 500)
>>> # save the cropped image as a new image on disk
>>> source_image.write('cropped.png')
| Source | Cropped |
|---|---|
|
|
| type source_image: | |
|---|---|
| Image | |
| param source_image: | |
| source image to crop | |
| type x1: | int |
| param x1: | X coordinate of beginning of the crop window |
| type y1: | int |
| param y1: | Y coordinate of beginning of the crop window |
| type x2: | int |
| param x2: | X coordinate of end of the crop window |
| type y2: | int |
| param y2: | Y coordinate of end of the crop window |
| rtype: | Image |
| return: | cropped image if crop process successful, otherwise source image |
Crop by Data Window¶
corp the source image to its data window.
| type source_image: | |
|---|---|
| Read | |
| param source_image: | |
| source image to crop | |
| rtype: | Read |
| return: | cropped image if crop process successful, otherwise source image |
Resize¶
resize the given image into the new width and height
Example:
>>> # read an image
>>> source_image = Read('source.exr')
>>> # resize the source image and store it in a new variable
>>> bar = resize(source_image, 1000, 500)
>>> # save the resize image as a new image on disk
>>> bar.write('resize.png')
| type source_image: | |
|---|---|
| Image | |
| param source_image: | |
| source image to crop | |
| type width: | int |
| param width: | width size |
| type height: | int |
| param height: | height size |
| rtype: | Image |
| return: | resize image if resize process successful, otherwise source image |
Scale¶
scale the given image iby the scale value.
Example:
>>> # read an image
>>> source_image = Read('source.exr')
>>> # scale the source image and store it in a new variable
>>> bar = scale(source_image, 1.5)
>>> # save the scaled image as a new image on disk
>>> bar.write('scaled.png')
| type source_image: | |
|---|---|
| Image | |
| param source_image: | |
| source image to crop | |
| type scale_value: | |
| float | |
| param scale_value: | |
| scale value | |
| rtype: | Image |
| return: | scaled image if scale process successful, otherwise source image |