rgb2gray
Project description
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();
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rgb2gray-0.0.4.tar.gz
(7.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rgb2gray-0.0.4.tar.gz.
File metadata
- Download URL: rgb2gray-0.0.4.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2af9ec6d7905e50d94905dae7603440c54b88befddcf14775890c4ab7b0f88a
|
|
| MD5 |
8533e8d7a99c019e41b260b243aa0960
|
|
| BLAKE2b-256 |
cf198162c1725a6b88c37fb7b34e727385d5046a0331197f9d52aeecc386c694
|
File details
Details for the file rgb2gray-0.0.4-py3-none-any.whl.
File metadata
- Download URL: rgb2gray-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07e671894f54a62264d39c48ee4441a8ab516047e0ffbc8533f03c26a608e5fa
|
|
| MD5 |
80b093f6a38c4f3941bb5d00cf7a248d
|
|
| BLAKE2b-256 |
8b2e86396f02ee93b407e7e9a9f091becbeede2ccf27320b371a8d5df3ab6958
|