How to use @jimp/custom - 3 common examples

To help you get started, we’ve selected a few @jimp/custom 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 oliver-moran / jimp / packages / test-utils / src / jgd-wrapper.js View on Github external
function configureJimp() {
  return configure({
    types: [
      () => ({
        mime: { 'image/png': ['png'] },

        constants: {
          MIME_PNG: 'image/png'
        },

        hasAlpha: { 'image/png': true },
        decoders: { 'image/png': PNG.sync.read },
        encoders: {
          'image/png': data => {
            const png = new PNG({
              width: data.bitmap.width,
              height: data.bitmap.height,
              bitDepth: 8,
github oliver-moran / jimp / packages / cli / src / cli.ts View on Github external
function loadConfiguration(
  plugins: string[],
  types: string[],
  verbose: boolean
) {
  if (!plugins.length && !types.length) {
    return;
  }

  log(` 🔄  Loading custom types/plugins into Jimp...`, verbose);

  const loadedPlugins = load('plugin', plugins, verbose);
  const loadedTypes = load('type', types, verbose);

  custom({ types: loadedTypes, plugins: loadedPlugins }, Jimp);
}
github akfish / node-vibrant / packages / vibrant-image-node / src / index.ts View on Github external
import {
  ImageOptions,
  ImageData,
  ImageSource,
  ImageCallback,
  ImageBase
} from '@vibrant/image'
import * as http from 'http'
import * as https from 'https'
import configure from '@jimp/custom'
import types from '@jimp/types'
import resize from '@jimp/plugin-resize'

const Jimp = configure({
  types: [types],
  plugins: [resize]
})

interface ProtocalHandler {
  get (url: string | any, cb?: (res: any) => void): any
}

interface ProtocalHandlerMap {
  [protocolName: string]: ProtocalHandler
}

const URL_REGEX: RegExp = /^(\w+):\/\/.*/i

const PROTOCOL_HANDLERS: ProtocalHandlerMap = {
  http,

@jimp/custom

Interface to customize jimp configuration

MIT
Latest version published 9 months ago

Package Health Score

97 / 100
Full package analysis

Popular @jimp/custom functions

Similar packages