Skip to content

Jimp error when using this package in the electron project's main process (background.js) #18

Description

@LehaoLin

Error shown as below

TypeError: Jimp.read is not a function
    at eval (webpack:///./node_modules/replace-color/src/replace-color.js?:43:10)
    at new Promise (<anonymous>)
    at module.exports (webpack:///./node_modules/replace-color/src/replace-color.js?:20:10)
    at IpcMainImpl.eval (webpack:///./src/background.js?:222:5)

And my code in the background.js is

var replaceColor = require('replace-color')
replaceColor({
      image: path_to_image,
      colors: {
        type: 'hex',
        targetColor: targetColor,
        replaceColor: '#00000000'
      },
      deltaE: 10
})
...

I trace the error message, and found the error is happened when reading the image.
which is in the node_modules/replace-color/src/replace-color.js line 43

Jimp.read(image)

I tried many ways including add async await stuff to make the process sync, but it is still not working.
Then no idea how to solve it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions