rgb2gray 0.0.4

Creator: railscoderz

Last updated:

Add to Cart

Description:

rgb2gray 0.0.4

rgb2gray

Install
pip install rgb2gray

How to use
An example with
rgb2gray
from PIL import Image
import matplotlib.pyplot as plt

result = rgb2gray(Image.new('RGB', (10, 10), color = (255,255,0)))
result

array([[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226],
[226, 226, 226, 226, 226, 226, 226, 226, 226, 226]], dtype=uint8)

plt.imshow(result, cmap='gray')
plt.show();


img = Image.open('images/ds.jpg')
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(15,10))

axes[0].imshow(img)
axes[1].imshow(rgb2gray(img), cmap='gray')
plt.show();

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.