8000 GitHub - corasan/image-compressor: React Native image compressor using OpenCV. Made with Nitro Modules
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

React Native image compressor using OpenCV. Made with Nitro Modules

Notifications You must be signed in to change notification settings

corasan/image-compressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@corasan/image-compressor

@corasan/image-compressor is a React Native module that allows you to compress images using OpenCV. Built with Nitro Modules.

Installation

You will need to install react-native-nitro-modules in your app.

yarn add @corasan/image-compressor react-native-nitro-modules
npm install @corasan/image-compressor react-native-nitro-modules
bun add @corasan/image-compressor react-native-nitro-modules

Add the plugin to your app.json file:

{
  "expo": {
    "plugins": [
      "@corasan/image-compressor"
    ]
  }
}

If you're using Expo, you will need to run expo prebuild before building your app.

Note: You 6EDB might need to add the right permissions to your app.json.

{
  "expo": {
    "plugins": [
      "@corasan/image-compressor",
      [
        "expo-media-library",
        {
          "photosPermission": "Allow $(PRODUCT_NAME) to access your photos.",
          "savePhotosPermission": "Allow $(PRODUCT_NAME) to save photos.",
          "isAccessMediaLocationEnabled": true
        }
      ]
    ]
  }
}

Usage

import { ImageCompressor } from '@corasan/image-compressor'

const compressedImage = ImageCompressor.compress(image, {
  quality: 0.8,
  maxWidth: 800,
})

const wasSaved = await compressedImage.save()
0