All Projects → emekalites → react-native-compress-image

emekalites / react-native-compress-image

Licence: MIT license
compress image with react native

Programming Languages

java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to react-native-compress-image

Apiproject
[https://www.sofineday.com], golang项目开发脚手架,集成最佳实践(gin+gorm+go-redis+mongo+cors+jwt+json日志库zap(支持日志收集到kafka或mongo)+消息队列kafka+微信支付宝支付gopay+api加密+api反向代理+go modules依赖管理+headless爬虫chromedp+makefile+二进制压缩+livereload热加载)
Stars: ✭ 124 (+463.64%)
Mutual labels:  compress
RecordVideo
视频录制压缩
Stars: ✭ 47 (+113.64%)
Mutual labels:  compress
ti.imagefactory
The ImageFactory Module for Appcelerator Titanium
Stars: ✭ 68 (+209.09%)
Mutual labels:  compress
Hsuntzu
HDFS compress tar zip snappy gzip uncompress untar codec hadoop spark
Stars: ✭ 135 (+513.64%)
Mutual labels:  compress
Compresshelper
🔥 压缩文件,压缩图片,压缩Bitmap,Compress, CompressImage, CompressFile, CompressBitmap:https://github.com/nanchen2251/AiYaCompressHelper
Stars: ✭ 2,362 (+10636.36%)
Mutual labels:  compress
web-dist
传统模式开发的web站点 进行整站所有文件压缩及混淆处理
Stars: ✭ 43 (+95.45%)
Mutual labels:  compress
Py7zr
7zip in python3 with ZStandard, PPMd, LZMA2, LZMA1, Delta, BCJ, BZip2, and Deflate compressions, and AES encryption.
Stars: ✭ 110 (+400%)
Mutual labels:  compress
QArchive
Async C++ Cross-Platform library that modernizes libarchive using Qt5 🚀. Simply extracts 7z 🍔, Tarballs 🎱 and other supported formats by libarchive. ❤️
Stars: ✭ 66 (+200%)
Mutual labels:  compress
Tiny
Blog:https://zhengxiaoyong.com Wechat:
Stars: ✭ 2,505 (+11286.36%)
Mutual labels:  compress
pclzip-doc-zh-cn
PHP 库 PclZip 的简体中文翻译文档(zh-cn translation for PHP lib: PclZip)
Stars: ✭ 25 (+13.64%)
Mutual labels:  compress
Cordova Plugin Mediapicker
cordova android ios mediaPicker support selection of multiple image and video gif ✨ cordova android 和 ios 图片视频选择cordova插件,支持多图 视频 gif,ui类似微信
Stars: ✭ 136 (+518.18%)
Mutual labels:  compress
Snzip
Snzip, a compression/decompression tool based on snappy
Stars: ✭ 177 (+704.55%)
Mutual labels:  compress
slimarray
SlimArray compresses uint32 into several bits, by using a polynomial to describe overall trend of an array.
Stars: ✭ 39 (+77.27%)
Mutual labels:  compress
Slim
Surprisingly space efficient trie in Golang(11 bits/key; 100 ns/get).
Stars: ✭ 1,705 (+7650%)
Mutual labels:  compress
VIDEOconvertor
A stable and Fast telegram video convertor bot which can encode into different libs and resolution, compress videos, convert video into audio and other video formats, rename with thumbnail support, generate screenshot and trim videos.
Stars: ✭ 180 (+718.18%)
Mutual labels:  compress
Tiny Html Minifier
Minify HTML in PHP with just a single class
Stars: ✭ 114 (+418.18%)
Mutual labels:  compress
ZipArchive
A single-class pure VB6 library for zip with ASM speed
Stars: ✭ 38 (+72.73%)
Mutual labels:  compress
LaraOutPress
This is simply compress your final out of Larvel Application and serve to the browser.
Stars: ✭ 56 (+154.55%)
Mutual labels:  compress
minifier
Middleware to minify Html, CSS and Javascript responses
Stars: ✭ 15 (-31.82%)
Mutual labels:  compress
xcompress
XCompress is a free file archiver utility on Linux, providing multi-format archiving to and extracting from ZIP, Z, GZIP, BZIP2, LZ, XZ, LZMA, 7ZIP, TAR, RAR and ZSTD.
Stars: ✭ 65 (+195.45%)
Mutual labels:  compress

React Native Compress Image

npm version npm downloads

React Native Compress Image for Android

NOTE: The iOS side of this module will be included when i have figured it out.

Installation

npm install --save react-native-compress-image

react-native link react-native-compress-image

NOTE: For Android, you will still have to manually update the AndroidManifest.xml (as below) in order to use Scheduled Notifications.

Android manual Installation

In your AndroidManifest.xml

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

In android/settings.gradle

include ':react-native-compress-image'
project(':react-native-compress-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-compress-image/android')

in android/app/build.gradle

dependencies {
    compile project(':react-native-compress-image')  // <--- Add package to dependencies
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"
    ....
}

in MainApplication.java:

import com.emekalites.react.compress.image.ImageCompressPackage;  // <--- Import Package

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
      @Override
      protected boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
      }

      @Override
      protected List<ReactPackage> getPackages() {
      	return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new ImageCompressPackage() 		// <---- Add the Package
        );
      }
  };
}

Usage

import CompressImage from 'react-native-compress-image';

CompressImage.createCompressedImage(imageUri, appDirectory).then((response) => {
  // response.uri is the URI of the new image that can now be displayed, uploaded...
  // response.path is the path of the new image
  // response.name is the name of the new image with the extension
  // response.size is the size of the new image
}).catch((err) => {
  // Oops, something went wrong. Check that the filename is correct and
  // inspect err to get more details.
});

CompressImage.createCustomCompressedImage(imageUri, appDirectory, maxWidth, maxHeight, quality).then((response) => {
  // response.uri is the URI of the new image that can now be displayed, uploaded...
  // response.path is the path of the new image
  // response.name is the name of the new image with the extension
  // response.size is the size of the new image
}).catch((err) => {
  // Oops, something went wrong. Check that the filename is correct and
  // inspect err to get more details.
});

Sample App

A basic, sample app is available in the example folder. It uses the module to compress a photo from the Camera Roll.

API

promise createCompressedImage(imageUri, appDirectory)

The promise resolves with an object containing: path, uri, name and size of the new file. The URI can be used directly as the source of an <Image> component.

Option Description
imageUri Path of image file whether jpeg or png
appDirectory The folder or path to save the compressed image

promise createCustomCompressedImage(imageUri, appDirectory, maxWidth, maxHeight, quality)

The promise resolves with an object containing: path, uri, name and size of the new file. The URI can be used directly as the source of an <Image> component.

Option Description
imageUri Path of image file whether jpeg or png
appDirectory The folder or path to save the compressed image
maxWidth Image maximum width
maxHeight Image maximum height
quality Image quality

Credits

https://github.com/zetbaitsu/Compressor

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].