13
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Pythonで白画像を作成する時のメモ。

Last updated at Posted at 2018-06-15

たびたび空白画像を作りたいことがあるが、その度に調べてたのでメモっとく。

グレースケール版です。

import numpy as np
import matplotlib.pyplot as plt

img_white = np.ones((300,300),np.uint8)*255
print(img_white)
plt.plot(), plt.imshow(img_white, cmap='gray', vmin=0, vmax=255)
plt.show()

カラー版

import numpy as np
import matplotlib.pyplot as plt

img_white = np.ones((300,300, 3),np.uint8)*255
plt.plot(), plt.imshow(img_white)
plt.show()

参考

13
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?