٤Ƴ٤Ĥ
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
|
!
 
 
 
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
from PIL import Image
import requests
import os
import subprocess
import sys
 
 
driver = webdriver.Chrome("/home/pi/chromedriver")
 
print( 'number of arguments:', len(sys.argv), 'arguments.')
arglist = sys.argv
print( 'Argument List:', sys.argv)
url=arglist[1]
print( 'url=', url)
 
driver.get(url)
driver.save_screenshot("ex1.png")
driver.close()
 
img = Image.open("ex1.png")
img_w, img_h = img.size
print('img_h:',img_h,',img_w:',img_w)
img_wc=img_w/2
img_hc=img_h/2
lx=img_wc-155
rx=img_wc+155
uy=img_hc-270
dy=img_hc+270
im_crop = img.crop((lx,uy,rx,dy))
#with open("ex2.png","wb") as aaa:
#  aaa.write(im_crop)
im_crop.save("ex2.png")
print('end save ex2.png')
subprocess.run(['/home/pi/python/pi_i2c_nano_neomatrix_ex7.py','ex2.png'])
 

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2021-12-05 (日) 10:37:20 (885d)