npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capacitor-mlkit/subject-segmentation

v8.0.1

Published

Capacitor plugin for ML Kit Subject Segmentation.

Readme

@capacitor-mlkit/subject-segmentation

Unofficial Capacitor plugin for ML Kit Subject Segmentation.[^1]

Compatibility

| Plugin Version | Capacitor Version | Status | | -------------- | ----------------- | -------------- | | 8.x.x | >=8.x.x | Active support |

Installation

npm install @capacitor-mlkit/subject-segmentation
npx cap sync

Android

API level

This plugin requires a minimum API level of 24.

Permissions

This API requires the following permissions be added to your AndroidManifest.xml before the application tag:

<uses-permission android:name="android.permission.CAMERA" />

You also need to add the following meta data in the application tag in your AndroidManifest.xml:

<meta-data android:name="com.google.mlkit.vision.DEPENDENCIES" android:value="subject_segment"/>
<!-- To use multiple models: android:value="face,model2,model3" -->

Usage

import { SubjectSegmentation } from '@capacitor-mlkit/subject-segmentation';

const processImage = async () => {
  const { path } = await SubjectSegmentation.processImage({
    path: 'path/to/image.jpg',
    confidence: 0.7,
  });
  return path;
};

API

processImage(...)

processImage(options: ProcessImageOptions) => Promise<ProcessImageResult>

Performs segmentation on an input image.

Only available on Android and iOS.

| Param | Type | | ------------- | ------------------------------------------------------------------- | | options | ProcessImageOptions |

Returns: Promise<ProcessImageResult>

Since: 7.2.0


isGoogleSubjectSegmentationModuleAvailable()

isGoogleSubjectSegmentationModuleAvailable() => Promise<IsGoogleSubjectSegmentationModuleAvailableResult>

Check if the Google Subject Segmentation module is available.

If the Google Subject Segmentation module is not available, you can install it by using installGoogleSubjectSegmentationModule().

Only available on Android.

Returns: Promise<IsGoogleSubjectSegmentationModuleAvailableResult>

Since: 7.2.0


installGoogleSubjectSegmentationModule()

installGoogleSubjectSegmentationModule() => Promise<void>

Install the Google Subject Segmentation module.

Attention: This only starts the installation. The googleSubjectSegmentationModuleInstallProgress event listener will notify you when the installation is complete.

Only available on Android.

Since: 7.2.0


addListener('googleSubjectSegmentationModuleInstallProgress', ...)

addListener(eventName: 'googleSubjectSegmentationModuleInstallProgress', listenerFunc: (event: GoogleSubjectSegmentationModuleInstallProgressEvent) => void) => Promise<PluginListenerHandle>

Called when the Google Subject Segmentation module is installed.

Only available on Android.

| Param | Type | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | eventName | 'googleSubjectSegmentationModuleInstallProgress' | | listenerFunc | (event: GoogleSubjectSegmentationModuleInstallProgressEvent) => void |

Returns: Promise<PluginListenerHandle>

Since: 7.2.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.

Only available on Android.

Since: 7.2.0


Interfaces

ProcessImageResult

| Prop | Type | Description | Since | | ------------ | ------------------- | ------------------------------------- | ----- | | path | string | The path to the segmented image file. | 7.2.0 | | width | number | Returns the width of the image file. | 7.2.0 | | height | number | Returns the height of the image file. | 7.2.0 |

ProcessImageOptions

| Prop | Type | Description | Default | Since | | ---------------- | ------------------- | ----------------------------------------------------------------------------------------- | ---------------- | ----- | | path | string | The local path to the image file. | | 7.2.0 | | width | number | Scale the image to this width. If no height is given, it will respect the aspect ratio. | | 7.2.0 | | height | number | Scale the image to this height. If no width is given, it will respect the aspect ratio. | | 7.2.0 | | confidence | number | Sets the confidence threshold. | 0.9 | 7.2.0 |

IsGoogleSubjectSegmentationModuleAvailableResult

| Prop | Type | Description | Since | | --------------- | -------------------- | ------------------------------------------------------------------- | ----- | | available | boolean | Whether or not the Google Subject Segmentation module is available. | 7.2.0 |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

GoogleSubjectSegmentationModuleInstallProgressEvent

| Prop | Type | Description | Since | | -------------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ----- | | state | GoogleSubjectSegmentationModuleInstallState | The current state of the installation. | 7.2.0 | | progress | number | The progress of the installation in percent between 0 and 100. | 7.2.0 |

Enums

GoogleSubjectSegmentationModuleInstallState

| Members | Value | Since | | --------------------- | -------------- | ----- | | UNKNOWN | 0 | 7.2.0 | | PENDING | 1 | 7.2.0 | | DOWNLOADING | 2 | 7.2.0 | | CANCELED | 3 | 7.2.0 | | COMPLETED | 4 | 7.2.0 | | FAILED | 5 | 7.2.0 | | INSTALLING | 6 | 7.2.0 | | DOWNLOAD_PAUSED | 7 | 7.2.0 |

Terms & Privacy

This plugin uses the Google ML Kit:

Changelog

See CHANGELOG.md.

License

See LICENSE.

[^1]: This project is not affiliated with, endorsed by, sponsored by, or approved by Google LLC or any of their affiliates or subsidiaries.