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

expo-apple-vision

v1.0.0

Published

A cross-platform Expo module for face detection and image analysis using Apple’s Vision framework on iOS.

Readme

Expo Apple Vision Module

This Expo module provides a native bridge to Apple's Vision framework, enabling face detection and analysis functionality for iOS applications.

Features

  • Face detection in images
  • Facial landmarks extraction (eyes, nose, mouth, etc.)
  • Facial attributes detection (smiling, eye state)

Installation

# Using npm
npm install expo-apple-vision

# Using yarn
yarn add expo-apple-vision

# Using expo
expo install expo-apple-vision

Usage

Detecting Faces in an Image

import React, { useEffect, useState } from "react";
import { View, Text, Image, StyleSheet } from "react-native";
import * as ImagePicker from "expo-image-picker";
import {
  detectFaces,
  FaceDetectionResult,
  FaceFeatures,
} from "expo-apple-vision";

export default function FaceDetectionScreen() {
  const [image, setImage] = useState<string | null>(null);
  const [faceData, setFaceData] = useState<FaceFeatures[] | null>(null);
  const [isLoading, setIsLoading] = useState(false);
  const [error, setError] = useState<string | null>(null);

  const pickImage = async () => {
    const result = await ImagePicker.launchImageLibraryAsync({
      mediaTypes: ImagePicker.MediaTypeOptions.Images,
      allowsEditing: true,
      quality: 1,
    });

    if (!result.cancelled && result.uri) {
      setImage(result.uri);
      await analyzeImage(result.uri);
    }
  };

  const analyzeImage = async (uri: string) => {
    try {
      setIsLoading(true);
      setError(null);

      // Call the face detection function
      const result = await detectFaces(uri);
      setFaceData(result.faces);

      console.log("Face detection results:", result);
    } catch (err) {
      setError(
        err instanceof Error ? err.message : "An unknown error occurred"
      );
      console.error("Face detection error:", err);
    } finally {
      setIsLoading(false);
    }
  };

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Face Detection Demo</Text>

      {image && <Image source={{ uri: image }} style={styles.image} />}

      {isLoading && <Text>Analyzing image...</Text>}

      {error && <Text style={styles.error}>{error}</Text>}

      {faceData && (
        <View style={styles.resultsContainer}>
          <Text style={styles.resultTitle}>
            {faceData.length} {faceData.length === 1 ? "face" : "faces"}{" "}
            detected
          </Text>

          {faceData.map((face, index) => (
            <View key={index} style={styles.faceData}>
              <Text>Face #{index + 1}</Text>
              <Text>Position: {JSON.stringify(face.boundingBox)}</Text>
              {/* Add more face attributes here if needed */}
            </View>
          ))}
        </View>
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
    padding: 20,
  },
  title: {
    fontSize: 24,
    fontWeight: "bold",
    marginBottom: 20,
  },
  image: {
    width: 300,
    height: 300,
    borderRadius: 10,
    marginBottom: 20,
  },
  resultsContainer: {
    width: "100%",
    marginTop: 20,
  },
  resultTitle: {
    fontSize: 18,
    fontWeight: "bold",
    marginBottom: 10,
  },
  faceData: {
    backgroundColor: "#f0f0f0",
    padding: 10,
    borderRadius: 5,
    marginBottom: 10,
  },
  error: {
    color: "red",
    marginTop: 10,
  },
});

Analyzing Multiple Images

import { detectFacesInMultipleImages } from "expo-apple-vision";

const analyzeMultipleImages = async (uris: string[]) => {
  try {
    const results = await detectFacesInMultipleImages(uris);

    // Process results for each image
    results.forEach((result, index) => {
      console.log(`Image ${index + 1} has ${result.faces.length} faces`);
    });

    return results;
  } catch (error) {
    console.error("Error analyzing multiple images:", error);
    throw error;
  }
};

API Reference

Functions

detectFaces(imageUri: string): Promise<FaceDetectionResult>

Analyzes a single image and detects faces.

  • Parameters:
    • imageUri (string): The local URI of the image to analyze
  • Returns: Promise resolving to a FaceDetectionResult object
  • Platform Support: iOS only (throws an error on Android and web)

detectFacesInMultipleImages(imageUris: string[]): Promise<FaceDetectionResult[]>

Analyzes multiple images and detects faces in each one.

  • Parameters:
    • imageUris (string[]): An array of local URIs of images to analyze
  • Returns: Promise resolving to an array of FaceDetectionResult objects
  • Platform Support: iOS only (throws an error on Android and web)

Types

FaceDetectionResult

interface FaceDetectionResult {
  faces: FaceFeatures[];
}

FaceFeatures

// ... existing code ...