All Projects → przemyslawpluta → removd

przemyslawpluta / removd

Licence: MIT license
Automatic ai cut outs of people, products and cars with https://www.remove.bg service

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to removd

ee.Screen
Takes screenshots of web pages for the list of URLs. Various resolutions, multiple formats (JPG, PDF, PNG and TXT)
Stars: ✭ 19 (-32.14%)
Mutual labels:  batch, automated
Face landmark factory
These are a set of tools using OpenCV, Tensorflow and Keras, with which you can generate your own model of facial landmark detection and demonstrate the effect of newly-generated model easily.
Stars: ✭ 120 (+328.57%)
Mutual labels:  face, automated
face
[deprecated] 👽 Face Recognition package for Laravel
Stars: ✭ 37 (+32.14%)
Mutual labels:  face
remove-gutenberg-panel
Removes the Try Gutenberg panel from the WP-Admin Dashboard, introduced in WordPress 4.9.5 Beta 1. We only want to try Gutenberg once it's ready. Not now.
Stars: ✭ 16 (-42.86%)
Mutual labels:  remove
smart-background
Automatically generate the background of the symbol picture, so you no longer have to worry about the background 自动生成符号背景,让你不再为背景头疼
Stars: ✭ 74 (+164.29%)
Mutual labels:  background
python-face-relighting
A python implementation of portrait lighting transfer using a mass transport approach.
Stars: ✭ 25 (-10.71%)
Mutual labels:  face
Faces
A Python wrapper around FaceApp 😔 → 😀
Stars: ✭ 79 (+182.14%)
Mutual labels:  face
multi-task-learning
Multi-task learning smile detection, age and gender classification on GENKI4k, IMDB-Wiki dataset.
Stars: ✭ 154 (+450%)
Mutual labels:  face
ai-face
人脸智能识别系统,本地上传图片,利用baidu-ai本地化人脸识别
Stars: ✭ 38 (+35.71%)
Mutual labels:  face
facetool
Command line utility to manipulate faces in videos and images
Stars: ✭ 38 (+35.71%)
Mutual labels:  face
ThreeDFace
3D Face Viewer
Stars: ✭ 35 (+25%)
Mutual labels:  face
winup
Automate a Windows 10 VM setup for coding and testing
Stars: ✭ 21 (-25%)
Mutual labels:  automated
cards
A deck of cards enumerating simple rules to design all new digital products at MAIF
Stars: ✭ 48 (+71.43%)
Mutual labels:  products
VideoTransparentBackground
Sample project displaying a video with transparent background in iOS app
Stars: ✭ 28 (+0%)
Mutual labels:  background
AttackSurfaceManagement
Discover the attack surface and prioritize risks with our continuous Attack Surface Management (ASM) platform - Sn1per Professional #pentest #redteam #bugbounty
Stars: ✭ 45 (+60.71%)
Mutual labels:  automated
dataloader-dotnet
DataLoader for .NET
Stars: ✭ 40 (+42.86%)
Mutual labels:  batch
S3FD
S3FD_Mxnet
Stars: ✭ 22 (-21.43%)
Mutual labels:  face
vue-responsive-video-background-player
Play your own videos in background responsively in different resolutions.
Stars: ✭ 212 (+657.14%)
Mutual labels:  background
import-cli-simple
This the meta package for Pacemaker Community, a Symfony based CLI application that provides import functionality for products, categories, attributes, and attribute-sets. The default format is CSV, adapters for XML are also available. The application can be declaratively extended by additional operations, which can be used to reassemble and exe…
Stars: ✭ 69 (+146.43%)
Mutual labels:  products
emacs
Nightly custom Emacs builds for macOS Nix environments
Stars: ✭ 25 (-10.71%)
Mutual labels:  automated

removd

NPM version Downloads CircleCI

Automatic ai cut outs of people, products and cars with remove.bg service.

splash

Requirements

API key from remove.bg service

Installation

npm i removd

Examples

Multiple examples can be located in examples directory

Usage

Images can be processed using file, url and base64 workflows. Balance and subscription details can be retrieved using account workflow.

removd.file

File workflow allows to upload files and save its outcome. Available options:

  • source required (string || array) - source filename to be forwarded for processing. Can be either single file or array of files (.png, .jpg, .jpeg files are supported).
  • glob optional (boolean) - glob patterns can be used to match files in multiple directories.
  • size optional (string) - can be set to small, medium, hd, 4k, auto. If omitted image will be automatically recognised and correct size option will be assigned.
  • detect optional (string) - can be set to person, product, car, auto. If omitted image will be automatically recognised.
  • channels optional (string) - can be set to rgba, alpha. If omitted defaults to rgba as RGB color corrections is used for highest quality.
  • background optional (string) - can be set to hex color code RGB, RGBA, RRGGBB, RRGGBBAA e.g. 81d4fa77 or rgba colors (R, G, B), (R, G, B, A), rgba(R, G, B, A) e.g. rgba(197, 127, 73, .5) or color name e.g. red, green etc. If omitted defaults to fully transparent hex.
  • format optional (string) - can be set to auto, png, jpg format. If omitted defaults to PNG format if transparent regions exists, otherwise JPEG.
  • destination optional (string) - directory where final image will be saved. Can be either path to directory or path to filename. If directory specyfied source filename will be used for saved outcome. If filename specyfied all processed images would be saved with it. If file already exists new file will be suffixed with nine character short id (defaults to source image directory).
  • deleteOriginal optional (boolean) - source image can be deleted after outcome returned back and saved (defaults to false).
  • progress optional (boolean) - track progress of processed images when source contains more then single item (defaults to false).
  • preserve optional (boolean) - upscale image to original dimensions if it has been downscaled previously due to being over 10 megapixels limit (defaults to false).
  • apikey optional (string) - service api key (defaults to REMOVD_API_KEY env veriable).

Basic file usage

const removd = require('removd');

(async () => {

    const done = await removd.file({
        source: '/directory/christopher-campbell-28567-unsplash-400x267.jpg'
    });

})();

Response done (object) will be similar to:

  {
    charged: 1,
    size: 'small',
    duration: '211 ms',
    dimensions: '400x267',
    destination: '/directory/christopher-campbell-28567-unsplash-400x267.png',
    detected: 'person',
    preserved: true,
    resized: false
  }
  • charged - amout of credits cherged by service to process image
  • size - size set to process image
  • duration - time it took to process the image
  • dimensions - dimanesions of the image
  • destination - directory where outcome image has been saved to
  • detected - outcome of the detection process
  • preserved - if original image dimensions has been preserved
  • resized - if image has been resized or not during processing

Advanced file usage

await removd.file({
    deleteOriginal: true,
    channels: 'alpha',
    detect: 'person',
    format: 'jpg',
    destination: '/new-directory/christopher-campbell.png',
    source: [
        '/directory/christopher-campbell-28567-unsplash-400x267.jpg',
        '/directory/christopher-campbell-28567-unsplash-2400x1600.jpg'
    ]
});

Response (array) will be similar to:

[
  {
    charged: 1,
    size: 'small',
    duration: '211 ms',
    dimensions: '400x267',
    destination: '/new-directory/christopher-campbell.jpeg',
    detected: 'person',
    preserved: true,
    resized: false
  },
  {
    charged: 5,
    size: 'hd',
    duration: '371 ms',
    dimensions: '2400x1600',
    destination: '/new-directory/christopher-campbell-23TplPdSD.jpeg',
    detected: 'person',
    preserved: true,
    resized: false
  }
]

If glob enabled glob patterns can be used in the source array to match images sent for processing:

await removd.file({
    glob: true,
    destination: '/new-directory/',
    background: 'rgba(111, 98, 199, 0.51)',
    source: [
        '/initial-directory/*.jpg',
        '/directory/christopher-campbell-28567-unsplash-2400x1600.jpg'
    ]
});

Response (array) will be similar to:

[
  {
    charged: 8,
    size: '4k',
    duration: '683 ms',
    dimensions: '3750x2500',
    destination: '/new-directory/christopher-campbell-28567-unsplash-3750x2500.png',
    detected: 'person',
    preserved: true,
    resized: false
  },
  {
    charged: 3,
    size: 'medium',
    duration: '111 ms',
    dimensions: '1500x1000',
    destination: '/new-directory/christopher-campbell-28567-unsplash-1500x1000.png',
    detected: 'person',
    preserved: true,
    resized: false
  },
  {
    charged: 5,
    size: 'hd',
    duration: '371 ms',
    dimensions: '2400x1600',
    destination: '/new-directory/christopher-campbell-28567-unsplash-2400x1600.png',
    detected: 'person',
    preserved: true,
    resized: false
  }
]

To preserve image dimensions when image is larger then service limit of 10 megapixels enable preserve option:

await removd.file({
    preserve: true,
    source: '/directory/christopher-campbell-28567-unsplash-5184x3456.jpg'
});

Response (object) will be similar to:

  {
    charged: 8,
    size: '4k',
    duration: '611 ms',
    dimensions: '5184x3456',
    destination: '/directory/christopher-campbell-28567-unsplash-5184x3456.png',
    detected: 'person',
    preserved: true,
    resized: true
  }

To track progress of processed images enable progress option then initialise batch to start processing:

  const batch = await removd.file({
      glob: true,
      progress: true,
      destination: '/new-directory/',
      source: [
        '/initial-directory/*.jpg',
        '/directory/christopher-campbell-28567-unsplash-2400x1600.jpg'
      ]
  });

  const files = batch.files;

  batch.progress.on('item', item => {});

  const done = await batch.init();

Response files (array) will be similar to:

[
  '/initial-directory/christopher-campbell-28567-unsplash-1500x1000.jpg',
  '/initial-directory/christopher-campbell-28567-unsplash-3750x2500.jpg',
  '/directory/christopher-campbell-28567-unsplash-2400x1600.jpg'
]

Response done (array) will be similar to:

[
  {
    charged: 8,
    size: '4k',
    duration: '683 ms',
    dimensions: '3750x2500',
    destination: '/new-directory/christopher-campbell-28567-unsplash-3750x2500.png',
    detected: 'person',
    preserved: true,
    resized: false
  },
  {
    charged: 3,
    size: 'medium',
    duration: '111 ms',
    dimensions: '1500x1000',
    destination: '/new-directory/christopher-campbell-28567-unsplash-1500x1000.png',
    detected: 'person',
    preserved: true,
    resized: false
  },
  {
    charged: 5,
    size: 'hd',
    duration: '371 ms',
    dimensions: '2400x1600',
    destination: '/new-directory/christopher-campbell-28567-unsplash-2400x1600.png',
    detected: 'person',
    preserved: true,
    resized: false
  }
]

removd.url

Url workflow allows to upload images available via url and save its outcome. Available options:

  • source required (string || array) - source url to be forwarded for processing. Can be either single url or array of urls.
  • detect optional (string) - can be set to person, product, car, auto. If omitted image will be automatically recognised.
  • channels optional (string) - can be set to rgba, alpha. If omitted defaults to rgba as RGB color corrections is used for highest quality.
  • background optional (string) - can be set to hex color code RGB, RGBA, RRGGBB, RRGGBBAA e.g. 81d4fa77 or rgba colors (R, G, B), (R, G, B, A), rgba(R, G, B, A) e.g. rgba(197, 127, 73, .5) or color name e.g. red, green etc. If omitted defaults to fully transparent hex.
  • format optional (string) - can be set to auto, png, jpg format. If omitted defaults to PNG format if transparent regions exists, otherwise JPEG.
  • destination required (string) - directory where final image will be saved. Can be either path to directory or path to filename. If directory specyfied source url filename will be used for saved outcome. If filename specyfied all processed images would be saved with it. If file already exists new file will be suffixed with nine character short id.
  • size optional (string) - can be set to small, medium, hd, 4k, auto. If omitted url image will be automatically recognised and correct size option will be assigned.
  • progress optional (boolean) - track progress of processed images when source contains more then single item (defaults to false).
  • preserve optional (boolean) - upscale image to original dimensions if it has been downscaled previously due to being over 10 megapixels limit (defaults to false).
  • apikey optional (string) - service api key (defaults to REMOVD_API_KEY env veriable)

Basic url usage

const removd = require('removd');

(async () => {

    const done = await removd.url({
        destination: '/directory/',
        source: 'https://images.unsplash.com/photo-1504455583697-3a9b04be6397?w=400&q=80'
    });

})();

Response done (object) will be similar to:

  {
    charged: 1,
    size: 'small',
    duration: '211 ms',
    dimensions: '400x267',
    destination: '/directory/photo-1504455583697-3a9b04be6397.png',
    detected: 'person',
    preserved: true,
    resized: false
  }
  • charged - amout of credits cherged by service to process image
  • size - size set to process image
  • duration - time it took to process the image
  • dimensions - dimanesions of the image
  • destination - directory where outcome image has been saved to
  • detected - outcome of the detection process
  • preserved - if original image dimensions has been preserved
  • resized - if image has been resized or not during processing

Advanced url usage

await removd.url({
    detect: 'person',
    format: 'jpg',
    background: 'red',
    destination: '/new-directory/',
    source: [
        'https://images.unsplash.com/photo-1504455583697-3a9b04be6397?w=400&q=80',
        'https://images.unsplash.com/photo-1504455583697-3a9b04be6397?w=2400&q=80'
    ]
});

Response (array) will be similar to:

[
  {
    charged: 1,
    size: 'small',
    duration: '211 ms',
    dimensions: '400x267',
    destination: '/new-directory/photo-1504455583697-3a9b04be6397l.jpeg',
    detected: 'person',
    preserved: true,
    resized: false
  },
  {
    charged: 5,
    size: 'hd',
    duration: '371 ms',
    dimensions: '2400x1600',
    destination: '/new-directory/photo-1504455583697-3a9b04be6397l-2FF3lddS1.jpeg',
    detected: 'person',
    preserved: true,
    resized: false
  }
]

removd.base64

Base64 workflow allows to upload images, base64 and base64url encoded txt files and save its outcome. Available options:

  • source required (string || array) - source filename to be forwarded for processing. Can be either single file or array of files (.png, .jpg, .jpeg, .txt files are supported).
  • glob optional (boolean) - glob patterns can be used to match files in multiple directories.
  • size optional (string) - can be set to small, medium, hd, 4k, auto. If omitted image will be automatically recognised and correct size option will be assigned.
  • detect optional (string) - can be set to person, product, car, auto. If omitted image will be automatically recognised.
  • channels optional (string) - can be set to rgba, alpha. If omitted defaults to rgba as RGB color corrections is used for highest quality.
  • background optional (string) - can be set to hex color code RGB, RGBA, RRGGBB, RRGGBBAA e.g. 81d4fa77 or rgba colors (R, G, B), (R, G, B, A), rgba(R, G, B, A) e.g. rgba(197, 127, 73, .5) or color name e.g. red, green etc. If omitted defaults to fully transparent hex.
  • format optional (string) - can be set to auto, png, jpg format. If omitted defaults to PNG format if transparent regions exists, otherwise JPEG.
  • destination optional (string) - directory where final image will be saved. Can be either path to directory or path to filename. If directory specyfied source filename will be used for saved outcome. If filename specyfied all processed images would be saved with it. If file already exists new file will be suffixed with nine character short id (defaults to source image directory).
  • deleteOriginal optional (boolean) - source image can be deleted after outcome returned back and saved (defaults to false).
  • toImage optional (boolean) - if source image is a base64 or base64url encoded text file processed outcome can be saved as an image (defaults to false).
  • progress optional (boolean) - track progress of processed images when source contains more then single item (defaults to false).
  • preserve optional (boolean) - upscale image to original dimensions if it has been downscaled previously due to being over 10 megapixels limit (defaults to false).
  • apikey optional (string) - service api key (defaults to REMOVD_API_KEY env veriable)

Basic base64 usage

const removd = require('removd');

(async () => {

    const done = await removd.base64({
        source: '/directory/christopher-campbell-28567-unsplash-400x267.txt'
    });

})();

Response done (object) will be similar to:

  {
    charged: 1,
    size: 'small',
    duration: '211 ms',
    dimensions: '400x267',
    destination: '/directory/christopher-campbell-28567-unsplash-400x267-g35fgj1Sp.txt',
    detected: 'person',
    preserved: true,
    resized: false
  }
  • charged - amout of credits cherged by service to process image
  • size - size set to process image
  • duration - time it took to process the image
  • dimensions - dimanesions of the image
  • destination - directory where outcome image has been saved to
  • detected - outcome of the detection process
  • preserved - if original image dimensions has been preserved
  • resized - if image has been resized or not during processing

Advanced base64 usage

await removd.base64({
    toImage: true,
    destination: '/new-directory/christopher-campbell.png',
    background: '00afff1f',
    source: [
        '/directory/christopher-campbell-28567-unsplash-400x267.jpg',
        '/directory/christopher-campbell-28567-unsplash-2400x1600.txt'
    ]
});

Response (array) will be similar to:

[
  {
    charged: 1,
    size: 'small',
    duration: '211 ms',
    dimensions: '400x267',
    destination: '/new-directory/christopher-campbell.png',
    detected: 'person',
    preserved: true,
    resized: false
  },
  {
    charged: 5,
    size: 'hd',
    duration: '371 ms',
    dimensions: '2400x1600',
    destination: '/new-directory/christopher-campbell-56T11Ptk3.png',
    detected: 'person',
    preserved: true,
    resized: false
  }
]

removd.account

Account workflow allows to retrieve details of current credit balance, number of free API calls and status of existing subscriptions. Balance changes may be delayed by several seconds.

Basic account usage

const removd = require('removd');

(async () => {

    const done = await removd.account();

    console.dir(done);

})();

Response (object) will be similar to:

  {
    credits: {
      total: 200,
      subscription: 150,
      payg: 50
    },
    api: {
      free_calls: 50,
      sizes: 'all'
    }
  }

Errors

All erros are resolved and fallow similar convention:

const removd = require('removd');

(async () => {

    const done = await removd.file({
        source: '/directory/christopher-campbell-28567-unsplash-400x267.bmp'
    });

})();

Response done (object) will be similar to:

  {
    error: 'Unsupported file format',
    source: '/directory/christopher-campbell-28567-unsplash-400x267.bmp'
  }

Enviroment variables

To limit batch processing use REMOVD_BATCH_LIMIT (defaults to cpu count).

REMOVD_BATCH_LIMIT=2

Tests

To run all available tests against previously recorded mocks

npm test

To record mocks either remove fixtures or force record with NOCK_RECORD

NOCK_RECORD=true npm test

As record is done against actual API endoints you'll be charged relevant amount of credits per test sequence.

Workflow Credits
file 109
base64 101
url 97
account 0

In total you'd be charged 307 credits for all available tests.

License

The MIT License (MIT). Please see license file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].