python 讀取圖片顏色值生成excel像素畫


一、利用到的包

1、進度條:progressbar

可以用pip安裝

pip install progressbar

若安裝很慢,可以-i 指定鏡像

pip install progressbar  -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

當然進度條有一個更牛逼的,可以自己研究,地址:https://github.com/tqdm/tqdm

2、excel操作包openpyxl

pip install openpyxl

若安裝很慢,可以指定鏡像

pip install openpyxl -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

當然也可以用其他excel操作包,原理都一樣。

二、代碼

代碼已經上傳github  地址:https://github.com/git-tree/img2excel

喜歡的點個贊✿✿ヽ(°▽°)ノ✿!

三、運行

打開cmd控制台(windows鍵+R,然后輸入cmd),輸入 python  img2excel_user.py  圖片地址  excel保存地址(要加上excel名字)

如 cmd 輸入運行:

python img2excel_user.py  D:/test.png  D:/outExcel.xlsx

四、效果圖

效果圖

demo圖片

over ✿✿ヽ(°▽°)ノ✿!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM