How you can edit your images using programming.

in blurt365 •  4 years ago  (edited)

So basically images are stored in form of arrays e.g. image[1365,2048,3] here 0th and 1st dimensions are number of rows and columns and the 3rd Dimension is value of color in cell formed by it.
IMG-20200928-WA0011.jpg

Using python we can manipulate the image and our filters or crop image.
To load and show image we need cv2 library and for editing photo we need to manipulate the array using numpy.
Example Code:

import cv2
photo=cv2.imread("image.jpg") //stores image in photo variable
cropPhoto = photo[10:100,10:100] //slices photo and shows only from 10 to 99th row and column
cv2.imshow("cropped",cropPhoto)
cv2.waitKey()
cv2.destroyAllWindows()

Similarly you can perform various array operations to edit your photos.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!