Code Monkey home page Code Monkey logo

sanity-plugin-asset-source-remove-bg's Introduction

sanity-plugin-asset-source-remove-bg

NOTE

This is the Sanity Studio v3 version of sanity-plugin-asset-source-remove-bg.

What is it?

Plugin for Sanity Studio providing asset source for removing the background of existing images with the Remove.bg API. Caution: The service offers 50 free preview images each month, which are of a lower quality, but you are able to purchase credits at their website. (I am not affiliated by any means with Remove.bg)

Features

  • Remove the background of images.
  • Select the type and format of the images.
  • See remaining free previews and credits left in your account.
  • Select which Sanity user roles are allowed to use the API.

What might be added

  • Set a custom background color or picture.

  • Batch conversion

  • Uploading an image directly to the plugin for bg removal without storing it in the sanity library

  • ??? any suggestions?

    Remove BG Asset Source

Installation

npm install --save sanity-plugin-asset-source-remove-bg

or

yarn add sanity-plugin-asset-source-remove-bg

Usage

Parameters:

  • apiKey: String | Can be created here: Remove.bg

  • allowedUserRoles?: String[]

    Add it as a plugin in sanity.config.ts (or .js):

 import {createConfig} from 'sanity'
 import {removeBgAssetSourcePlugin} from 'sanity-plugin-remove-bg-converter'

 export const createConfig({
     /...
     plugins: [
         removeBgAssetSourcePlugin({
             apiKey: "my-api-key",
             allowedUserRoles: ["administrator", "editor"]
         })
     ]
 })

Develop & test

Make sure to run npm run build once, then run

npm run link-watch

In another shell, cd to your test studio and run:

npx yalc add sanity-plugin-asset-source-giphy --link && yarn install

Now, changes in this repo will be automatically built and pushed to the studio, triggering hotreload. Yalc avoids issues with react-hooks that are typical when using yarn/npm link.

About build & watch

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

License

MIT © Rein Undheim See LICENSE

sanity-plugin-asset-source-remove-bg's People

Contributors

gawdfrey avatar semantic-release-bot avatar

Stargazers

 avatar

Watchers

 avatar

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.