[問題] Selenium save_screenshot to buffer

看板Python作者 (ching)時間8年前 (2017/02/08 16:30), 8年前編輯推噓1(103)
留言4則, 2人參與, 最新討論串1/1
小弟用pytesseract練習圖形辨識 首先用selenium save_screenshot儲存檔案 再用PIL crop後成功做到簡單的圖片辨識 想說能不能save_screenshot存到buffer並讓PIL享用? save_screenshot()可接受參數介紹為=> need string or buffer, 因為看到這句才有的想法 但幾經胡亂嘗試都失敗,求版上解惑,感恩@@ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 192.83.177.90 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1486542632.A.634.html ※ 編輯: coolching (192.83.177.90), 02/08/2017 16:31:19

02/08 17:40, , 1F
get_screenshot_as_png() ?
02/08 17:40, 1F

02/09 16:48, , 2F
回樓上,Image.open()吃不下去...
02/09 16:48, 2F

02/09 19:12, , 3F
就 StringIO 轉一層就可以當檔案開啟使用
02/09 19:12, 3F

02/10 14:26, , 4F
感恩大大!!!成功了!!
02/10 14:26, 4F
文章代碼(AID): #1OcjSeOq (Python)
文章代碼(AID): #1OcjSeOq (Python)