Here's an example of an image editor in Python using the Pillow library:
pythonfrom PIL import Image, ImageEnhance, ImageFilter
# Open image
image = Image.open('input.jpg')
# Show original image
image.show()
# Convert image to grayscale
gray_image = image.convert('L')
# Show grayscale image
gray_image.show()
# Apply color filter
color_filter = ImageEnhance.Color(image)
color_image = color_filter.enhance(2)
# Show color image
color_image.show()
# Apply blur filter
blur_filter = image.filter(ImageFilter.BLUR)
blur_image = blur_filter.filter(ImageFilter.BLUR)
# Show blurred image
blur_image.show()
# Save edited image
color_image.save('output.jpg')
This code uses the Pillow library to open and manipulate an image file. The Image.open()
method is used to open the input.jpg
file, and the Image.convert()
method is used to convert the image to grayscale. The ImageEnhance.Color()
method is used to apply a color filter to the original image, and the ImageFilter.BLUR
constant is used to create a blur filter. The Image.filter()
method is used twice to apply the blur filter twice, creating a more pronounced blur effect. The Image.show()
method is used to display each edited image, and the Image.save()
method is used to save the final edited image to a file named output.jpg
.
To use the app, simply provide your own image file and modify the code accordingly. You can also experiment with different filters and effects provided by the Pillow library to create your own image editing tools.