iggh966380 / get-picture-color Goto Github PK
View Code? Open in Web Editor NEW可以顯示圖片中pixel的顏色色碼
可以顯示圖片中pixel的顏色色碼
可以建立一個包含物件URL的字串,代表了傳入參數的物件
這個URL的生命週期會跟document綁在一起,離開該頁面 -> URL銷毀 (在SPA中?)
語法
createObjectURL(object);
其中object可以是檔案,二進位檔(圖片),mediasource(影片)
return代表了傳入的object網址
使用上的注意:
記憶體管理:
在呼叫了createObjURL之後都會建立一個新的物件URL,就算是在這之前就有針對同樣的物件建立過物件URL,也因此在確定用不到該物件URL之後要呼叫 revokeObjURL() 進行釋放,儘管在離開頁面後就會自動銷毀,但基於效能及記憶體管理,進行手動釋放還是比較好的做法。
針對媒體串流(影片):
在較為老舊的媒體資源中,在使用video標籤時需要進行createObjURL建立媒體串流物件的URL,不過現在已經不需要這麼做,瀏覽器也都在移除針對這件事的支持度。
如果真的還有code是依賴著createObjURL()的話,可以用srcObject直接綁定在媒體串流上
針對媒體串流只剩下ie10還有在支援
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.