Giter Club home page Giter Club logo

replace-color's People

Contributors

dependabot[bot] avatar maxnordlund avatar turakvlad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

replace-color's Issues

Removing colour from text

Hey,

Great library.

I'm trying to remove the green from this image.

_hotspot_1267_87a1eb10-f1f4-11e8-a55f-1d333c2d6ce0
hotspot_1267_87a1eb10-f1f4-11e8-a55f-1d333c2d6ce0

Here is my code

replaceColor({
image: dir + '/' + image.src,
colors: {
type: 'hex',
targetColor: '#00ff00',
replaceColor: '#00000000',
deltaE: 20
}
})

I'm still getting a green tinge around the letters.

Do you know how I can completely remove all the green?

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

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.

Not compatible with latest jimp version (0.6.4)

Hey guys, here we go again :)

The library is using jimp ^0.5.3 and not compatible with the latest jimp version I use in my project (0.6.4). As last time, upgrading jimp here should do the trick :)

Affected by this lack of compatibility is my desire to composite images that have been manipulated with replace-color.

const transformedImage = await replaceColor({
        image: imagePath,
        colors: {
          targetColor,
          replaceColor: desiredColor,
          type: 'hex'
        }
      })

Afterwards, when trying to someImage.composite(transformedImage, 0, 0) I get the error message that transformedImage is not a valid jimp object.

Looking forward to the fix!

Janik

Ability to specify return type other than jimp object

It would be useful to return something other than a jimp object, such that I could call replaceColor with a Buffer and receive a Buffer back.

Happy to write a PR if it would be welcomed. All it would require is potentially a new return type param and if buffer calling the jimp getBuffer.

Not compatible with latest jimp version (0.5.3)

Hey guys,

I've been trying to replace colors for an image using this library and then using jimp (0.5.3) to composite different images together.

my code:

  const transformedImage = await replaceColor({
        image: jimpObject | imagePath,
        colors: {
          targetColor,
          replaceColor: desiredColor,
          type: 'hex'
        }
      })

I encountered two errors:

  1. When the image parameter was the path to the image, transforming worked, but in the step where I did someJimpInstance.composite(transformedImage), jimp was complaining that transformedImage wasn't a valid jimp instance, even though the instanceof Jimp test was true.

  2. When using a jimpObject as a value for the image parameter, replaceColor threw this error: No matching constructor overloading was found. Please see the docs for how to call the Jimp constructor., even though the jimpObject was a valid jimp object.

Downgrading to jimp 0.3.11 solved the problems for me.

Ability to pass in jimp object instead of image url

Hey,

I am using this package in react app, and would like to pass in jimp object that was already preprocessed to replace color util as alternative to url to image (keep both options ofc). Jimp can not write to output when used on client side (or at least I could not make it work), so writing and reading again is not solution for me just to use this tool's interface.
I can fork this and adapt to my needs, just wanted to check if there are some restrictions to this, and if this would be useful to you, I can create PR for it?

How to define transparent in targetColor or replaceColor?

type: rgb Alpha is not supported so transparent color can't be defined.

type: hex Based on this stackoverflow answer, transparent hex code is #AARRGGBB, but it's an invalid parameter.

{ ReplaceColorError: Parameter is not valid
    at Promise (node_modules\replace-color\src\replace-color.js:32:23)
    at new Promise (<anonymous>)
    at module.exports (node_modules\replace-color\src\replace-color.js:20:10)
    (truncated)
  name: 'ReplaceColorError',
  code: 'PARAMETER_INVALID',
  field: 'options.colors.targetColor' }

Is there a way to use transparent as one of the parameter? Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.