File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2703,16 +2703,16 @@ from PIL import Image
2703
2703
```
2704
2704
2705
2705
``` python
2706
- < tuple / int > = < Image> .getpixel((x, y)) # Returns a pixel.
2707
- < Image> .putpixel((x, y), < tuple / int > ) # Writes a pixel to the image.
2706
+ < int / tuple > = < Image> .getpixel((x, y)) # Returns a pixel.
2707
+ < Image> .putpixel((x, y), < int / tuple > ) # Writes a pixel to the image.
2708
2708
< ImagingCore> = < Image> .getdata() # Returns a sequence of pixels.
2709
2709
< Image> .putdata(< list / ImagingCore> ) # Writes a sequence of pixels.
2710
2710
< Image> .paste(< Image> , (x, y)) # Writes an image to the image.
2711
2711
```
2712
2712
2713
2713
``` bash
2714
- < 2d_array> = np.array(< Image > ) # Creates NumPy array from greyscale image.
2715
- < 3d_array> = np.array(< Image > ) # Creates NumPy array from color image.
2714
+ < 2d_array> = np.array(< Image_L > ) # Creates NumPy array from greyscale image.
2715
+ < 3d_array> = np.array(< Image_RGB > ) # Creates NumPy array from color image.
2716
2716
< Image> = Image.fromarray(< array> ) # Creates image from NumPy array of floats.
2717
2717
```
2718
2718
Original file line number Diff line number Diff line change 2320
2320
<Image>.save(< span class ="hljs-string "> '<path>'</ span > )
2321
2321
<Image>.show()
2322
2322
</ code > </ pre >
2323
- < pre > < code class ="python language-python hljs "> <tuple/ int> = <Image>.getpixel((x, y)) < span class ="hljs-comment "> # Returns a pixel.</ span >
2324
- <Image>.putpixel((x, y), <tuple/ int>) < span class ="hljs-comment "> # Writes a pixel to the image.</ span >
2323
+ < pre > < code class ="python language-python hljs "> <int/tuple > = <Image>.getpixel((x, y)) < span class ="hljs-comment "> # Returns a pixel.</ span >
2324
+ <Image>.putpixel((x, y), <int/tuple >) < span class ="hljs-comment "> # Writes a pixel to the image.</ span >
2325
2325
<ImagingCore> = <Image>.getdata() < span class ="hljs-comment "> # Returns a sequence of pixels.</ span >
2326
2326
<Image>.putdata(<list/ImagingCore>) < span class ="hljs-comment "> # Writes a sequence of pixels.</ span >
2327
2327
<Image>.paste(<Image>, (x, y)) < span class ="hljs-comment "> # Writes an image to the image.</ span >
2328
2328
</ code > </ pre >
2329
- < pre > < code class ="bash language-bash hljs "> <2d_array> = np.array(<Image >) < span class ="hljs-comment "> # Creates NumPy array from greyscale image.</ span >
2330
- <3d_array> = np.array(<Image >) < span class ="hljs-comment "> # Creates NumPy array from color image.</ span >
2329
+ < pre > < code class ="bash language-bash hljs "> <2d_array> = np.array(<Image_L >) < span class ="hljs-comment "> # Creates NumPy array from greyscale image.</ span >
2330
+ <3d_array> = np.array(<Image_RGB >) < span class ="hljs-comment "> # Creates NumPy array from color image.</ span >
2331
2331
<Image> = Image.fromarray(<array>) < span class ="hljs-comment "> # Creates image from NumPy array of floats.</ span >
2332
2332
</ code > </ pre >
2333
2333
< div > < h3 id ="modes-1 "> Modes</ h3 > < ul >
You can’t perform that action at this time.
0 commit comments