colorthief利用Javascript和canvas標(biāo)簽是怎樣的-創(chuàng)新互聯(lián)

color thief利用Javascript和canvas標(biāo)簽是怎樣的,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。

專注于為中小企業(yè)提供成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)灤南免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了近千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

Color Thief 是用于提取圖片的主要顏色或者代表性顏色調(diào)色板的工具. 其使用是基于 javascript 和 canvas 的.color-thief-py 是基于 Python 和 Pillow 的實(shí)現(xiàn).

color thief利用 Javascript 和 canvas 標(biāo)簽

獲取一張圖片的主要顏色

var colorThief = new ColorThief();

colorThief.getColor(sourceImage);

getColor(sourceImage[, quality])

returns {r: num, g: num, b: num}

從一張圖片中創(chuàng)建調(diào)色板

在這個示例中,我們創(chuàng)建一個包含8個顏色的調(diào)色板。

var colorThief = new ColorThief();

colorThief.getPalette(sourceImage, 8);

getPalette(sourceImage[, colorCount, quality])

returns [ [num, num, num], [num, num, num], ... ]

color thief特點(diǎn)

Getting started

The Color Thief package includes multiple distribution files to support different environments and build processes. Here is the list of all the files in the /dist folder and what formats they support:

color-thief.js - CommonJS module for use in Node.

color-thief.mjs - ES6 module. For modern browsers as well as Webpack and Rollup.

color-thief.umd.js - UMD module. For simple script tag loading that exposes a global variable or for RequireJS AMD support.

color-thief.min.js - Duplicate of color-thief.umd.js. Kept around to maintain backwards compatibility.

看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,的支持。

文章題目:colorthief利用Javascript和canvas標(biāo)簽是怎樣的-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://bm7419.com/article2/dgodic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、網(wǎng)站建設(shè)、云服務(wù)器、建站公司、品牌網(wǎng)站設(shè)計(jì)商城網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)