How to use the jimp.cssColorToHex function in jimp

To help you get started, we’ve selected a few jimp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NiGhTTraX / mugshot / tests / node / suite.ts View on Github external
function getHexFromChar(pixel: string) {
  switch (pixel) {
    case 'R':
      return Jimp.cssColorToHex('#ff0000');
    case 'G':
      return Jimp.cssColorToHex('#00ff00');
    case 'B':
      return Jimp.cssColorToHex('#0000ff');
    case 'K':
      return Jimp.cssColorToHex('#000000');
    default:
      return Jimp.cssColorToHex('#ffffff');
  }
}
github NiGhTTraX / mugshot / tests / node / suite.ts View on Github external
function getHexFromChar(pixel: string) {
  switch (pixel) {
    case 'R':
      return Jimp.cssColorToHex('#ff0000');
    case 'G':
      return Jimp.cssColorToHex('#00ff00');
    case 'B':
      return Jimp.cssColorToHex('#0000ff');
    case 'K':
      return Jimp.cssColorToHex('#000000');
    default:
      return Jimp.cssColorToHex('#ffffff');
  }
}
github NiGhTTraX / mugshot / tests / node / suite.ts View on Github external
function getHexFromChar(pixel: string) {
  switch (pixel) {
    case 'R':
      return Jimp.cssColorToHex('#ff0000');
    case 'G':
      return Jimp.cssColorToHex('#00ff00');
    case 'B':
      return Jimp.cssColorToHex('#0000ff');
    case 'K':
      return Jimp.cssColorToHex('#000000');
    default:
      return Jimp.cssColorToHex('#ffffff');
  }
}
github NiGhTTraX / mugshot / tests / node / suite.ts View on Github external
function getHexFromChar(pixel: string) {
  switch (pixel) {
    case 'R':
      return Jimp.cssColorToHex('#ff0000');
    case 'G':
      return Jimp.cssColorToHex('#00ff00');
    case 'B':
      return Jimp.cssColorToHex('#0000ff');
    case 'K':
      return Jimp.cssColorToHex('#000000');
    default:
      return Jimp.cssColorToHex('#ffffff');
  }
}
github NiGhTTraX / mugshot / tests / node / suite.ts View on Github external
function getHexFromChar(pixel: string) {
  switch (pixel) {
    case 'R':
      return Jimp.cssColorToHex('#ff0000');
    case 'G':
      return Jimp.cssColorToHex('#00ff00');
    case 'B':
      return Jimp.cssColorToHex('#0000ff');
    case 'K':
      return Jimp.cssColorToHex('#000000');
    default:
      return Jimp.cssColorToHex('#ffffff');
  }
}
github evanchiu / serverless-galleria / rotate / src / index.js View on Github external
async function rotate(inBuffer) {
  const image = await jimp.read(inBuffer);
  image.background(jimp.cssColorToHex(backgroundColor)).rotate(rotateDegrees);
  return image.getBufferAsync(jimp.MIME_JPEG);
}
github CODAIT / node-red-contrib-model-asset-exchange / utils / index.js View on Github external
const drawRect = (img, xMin, yMin, xMax, yMax, padSize, color, isFilled) => {
  for (x of range(xMin, xMax)) {
    for (y of range(yMin, yMax)) { 
      if (withinRange(y, yMin, padSize) || withinRange(x, xMin, padSize) || 
          withinRange(y, yMax, padSize) || withinRange(x, xMax, padSize)) {
        img.setPixelColor(Jimp.cssColorToHex(color), x, y);
      } else if (isFilled && (y <= (yMax + padSize) && x <= (xMax + padSize))) {
        img.setPixelColor(Jimp.cssColorToHex(color), x, y);
      }
    }
  }
}