jimp-dev/jimp

How to set bitmap with DataURL

オープン

#1,023 opened on 2021/07/04

 (0 件のコメント) (1 件のリアクション) (0 人の担当者)JavaScript (785 件のフォーク)batch import
bughelp wanted

Repository metrics

Stars
 (13,218 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド