Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"html-entities": "2.6.0",
"i18next": "19.1.0",
"iconv-lite": "0.4.18",
"jimp": "^1.6.0",
"image-js": "^0.37.0",
"jshashes": "1.0.8",
"jsrsasign": "10.5.20",
"ksuid": "1.2.0",
Expand Down
12 changes: 4 additions & 8 deletions src/plugins/kapitalbank-uz/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Jimp } from 'jimp'
import { Image } from 'image-js'
import { delay, generateRandomString } from '../../common/utils'
import { InvalidLoginOrPasswordError } from '../../errors'
import {
Expand Down Expand Up @@ -56,16 +56,12 @@ async function blobToBase64WithResolution (blob, targetWidth, targetHeight) {
console.log('Buffer.from begins')
const buffer = Buffer.from(await blob.arrayBuffer())
console.log('fromBuffer begin')
const image = await Jimp.fromBuffer(buffer)
const image = await Image.load(buffer)
console.log('fromBuffer complete')
const resizedImage = image.resize({ w: targetWidth, h: targetHeight })
const resizedImage = image.resize({ width: targetWidth, height: targetHeight })
console.log('resize complete')
const base64String = await resizedImage.getBase64('image/jpeg')
const base64String = `data:image/jpeg;base64,${resizedImage.toBase64('image/jpeg')}`
console.log('getBase64 complete')
// const image = await Image.load(buffer)
// const resizedImage = image.resize({ width: targetWidth, height: targetHeight })
// const base64String = `data:image/jpeg;base64,${resizedImage.toBase64('image/jpeg')}`
// return base64String
return base64String
}

Expand Down