jimp-dev/jimp

How to set bitmap with DataURL

開放

#1,023 建立於 2021年7月4日

 (0 則留言) (1 個反應) (0 位負責人)JavaScript (785 個分叉)batch import
bughelp wanted

倉庫指標

星標
 (13,218 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

const setdpi = () => ({

    setdpi (dpi, callback) {

        if ( typeof dpi !== 'number' ) return throwError.call(this, '( dpi ) must be a number', callback);

        this.getBase64Async(this._originalMime).then( b64 => {
            const [ none, b64_dpi ] = changeDPI.changeDpiDataUrl(b64, dpi).split(',')
            const b64_buffer = Buffer.from( b64_dpi, 'base64' )
            this.bitmap.data = b64_buffer 
        })

        return this

    }

})

the code above does not work, so what is the problem

貢獻者指南