react-native-image-zoom-viewer vs react-native-image-crop-picker vs react-native-image-resizer vs @bam.tech/react-native-image-resizer
React Native Image Handling Libraries Comparison
1 Year
react-native-image-zoom-viewerreact-native-image-crop-pickerreact-native-image-resizer@bam.tech/react-native-image-resizerSimilar Packages:
What's React Native Image Handling Libraries?

These libraries provide various functionalities for handling images in React Native applications, including resizing, cropping, and displaying images in a zoomable viewer. They cater to different use cases, from simple image manipulation to complex image selection and display, making it easier for developers to implement image-related features in their apps.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
react-native-image-zoom-viewer141,9022,453117 kB195-MIT
react-native-image-crop-picker115,5296,2402.78 MB60417 days agoMIT
react-native-image-resizer40,0431,642-54 years agoMIT
@bam.tech/react-native-image-resizer35,6961,64293.2 kB57 months agoMIT
Feature Comparison: react-native-image-zoom-viewer vs react-native-image-crop-picker vs react-native-image-resizer vs @bam.tech/react-native-image-resizer

Image Resizing

  • react-native-image-zoom-viewer:

    This package does not focus on resizing images but rather on displaying them in a zoomable format, so resizing is not applicable.

  • react-native-image-crop-picker:

    While primarily focused on cropping and selecting images, it also includes basic resizing features. However, it is not as specialized in resizing as other dedicated libraries.

  • react-native-image-resizer:

    This library offers a straightforward way to resize images by specifying new dimensions. It is easy to use and integrates well with other image processing tasks.

  • @bam.tech/react-native-image-resizer:

    This package provides a simple API to resize images efficiently, allowing developers to specify the desired width, height, and quality. It is optimized for performance and can handle large images without significant delays.

Image Cropping

  • react-native-image-zoom-viewer:

    This package does not handle cropping but focuses on displaying images in a zoomable viewer.

  • react-native-image-crop-picker:

    This library excels in image cropping, providing an intuitive UI for users to crop images after selection. It supports various aspect ratios and is highly customizable.

  • react-native-image-resizer:

    This package does not include cropping functionality; it is strictly for resizing images.

  • @bam.tech/react-native-image-resizer:

    This package does not support cropping images; its primary function is resizing.

User Experience

  • react-native-image-zoom-viewer:

    This package offers a great user experience for viewing images, allowing users to zoom in and out easily, enhancing the visual interaction with images.

  • react-native-image-crop-picker:

    This library provides a rich user experience with a customizable interface for selecting and cropping images, making it user-friendly and visually appealing.

  • react-native-image-resizer:

    The user experience is straightforward, as it is a backend utility without a dedicated UI. Developers need to implement their own UI for image selection and display.

  • @bam.tech/react-native-image-resizer:

    The user experience is minimal since it operates in the background without direct user interaction. It is designed for developers who need quick image processing without UI components.

Performance

  • react-native-image-zoom-viewer:

    Performance is generally good, but it may depend on the number of images being displayed and their resolutions.

  • react-native-image-crop-picker:

    This library is also optimized for performance, but the image selection and cropping processes can be resource-intensive, especially with high-resolution images.

  • react-native-image-resizer:

    Performance is good for basic resizing tasks, but it may not handle very large images as efficiently as specialized libraries.

  • @bam.tech/react-native-image-resizer:

    Optimized for performance, this package handles image resizing efficiently, minimizing memory usage and processing time, which is crucial for mobile applications.

Integration

  • react-native-image-zoom-viewer:

    This package integrates well with existing image display components, allowing for a seamless user experience when viewing images.

  • react-native-image-crop-picker:

    Integration is straightforward, with clear documentation and examples, making it easy to implement in various applications.

  • react-native-image-resizer:

    Simple to integrate, this library can be added to projects with minimal effort, allowing developers to quickly start resizing images.

  • @bam.tech/react-native-image-resizer:

    This package is easy to integrate into existing React Native projects, requiring minimal setup and configuration.

How to Choose: react-native-image-zoom-viewer vs react-native-image-crop-picker vs react-native-image-resizer vs @bam.tech/react-native-image-resizer
  • react-native-image-zoom-viewer:

    Use this package when you need to display images in a zoomable viewer. It is perfect for applications that require a gallery or detailed image viewing experience, allowing users to pinch and zoom on images.

  • react-native-image-crop-picker:

    Select this package if you require a comprehensive image picker with cropping capabilities. It supports both single and multiple image selection and provides a user-friendly interface for cropping images, making it suitable for applications that need robust image handling features.

  • react-native-image-resizer:

    Opt for this package if you want a straightforward image resizing solution without additional features. It is useful for basic image resizing tasks and is easy to integrate into existing projects.

  • @bam.tech/react-native-image-resizer:

    Choose this package if you need a lightweight solution specifically for resizing images on the fly. It is ideal for optimizing images before uploading them to a server or displaying them in your app.

README for react-native-image-zoom-viewer

Show Cases

Swiper image

Zoom while sliding

Swipe down

Getting Started

Installation

npm i react-native-image-zoom-viewer --save

Basic Usage

  • Install create-react-native-app first
$ npm install -g create-react-native-app
  • Initialization of a react-native project
$ create-react-native-app AwesomeProject
  • Then, edit AwesomeProject/App.js, like this:
import { Modal } from 'react-native';
import ImageViewer from 'react-native-image-zoom-viewer';

const images = [{
    // Simplest usage.
    url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460',

    // width: number
    // height: number
    // Optional, if you know the image size, you can set the optimization performance

    // You can pass props to <Image />.
    props: {
        // headers: ...
    }
}, {
    url: '',
    props: {
        // Or you can set source directory.
        source: require('../background.png')
    }
}]

export default class App extends React.Component {
    render: function() {
        return (
            <Modal visible={true} transparent={true}>
                <ImageViewer imageUrls={images}/>
            </Modal>
        )
    }
}

Props

| parameter | type | required | description | default | | :--------------------- | :------------------------------------------------------------------------------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | | imageUrls | array | yes | Image Source | | | enableImageZoom | boolean | no | Enable image zoom | true | | onShowModal | function

(content?: JSX.Element) => void | no | The callback for show modal | () => {} | | onCancel | function

() => void | no | The callback for cancel modal | () => {} | | flipThreshold | number | no | Swipe threshold of the next page | 80 | | maxOverflow | number | no | The X position maximum, that current page can slide to the next page | 300 | | index | number | no | Init index of images | 0 | | failImageSource | string, object

{url: string} | no | placeholder for fail | '' | | loadingRender | function

() => React.ReactElement<any> | no | placeholder for loading | () => null | | onSaveToCamera | function

(index?: number => void | no | The callback for save to camera | () => {} | | onChange | function

(index?: number => void | no | When the image changed | () => {} | | onMove | ( position: IOnMove )=>void | reports movement position data (helpful to build overlays) | ()=> {} | | saveToLocalByLongPress | boolean | no | Enable save to camera when long press | true | | onClick | function

(onCancel?: function) => void | no | Onclick | (onCancel) => {onCancel()} | | onDoubleClick | function

(onCancel?: function) => void | no | OnDoubleClick | (onCancel) => {onCancel()} | | onSave | function

(url: string) => void | no | The picture is saved to the local method, if you write this method will not call the system default method for Android does not support saveToCameraRoll remote picture, you can call this callback in Android call native interface | | | renderHeader | function

(currentIndex?: number) => React.ReactElement<any> | no | Custom header | () => null | | renderFooter | function

(currentIndex?: number) => React.ReactElement<any> | no | Custom footer | () => null | | renderIndicator | function

(currentIndex?: number, allSize?) => React.ReactElement<any>: number | no | Custom indicator | (currentIndex, allSize) => currentIndex + "/" + allSize | | renderImage | function

(props: any) => React.ReactElement<any> | no | Custom image component | (props) => <Image {...props} /> | | renderArrowLeft | function

() => React.ReactElement<any> | no | Custom left arrow | () => null | | renderArrowRight | function

() => React.ReactElement<any> | no | Custom right arrow | () => null | | onSwipeDown | function

() => void | no | Callback for swipe down | () => null | | footerContainerStyle | object

{someStyle: someValue} | no | custom style props for container that will be holding your footer that you pass | bottom: 0, position: "absolute", zIndex: 9999 | | backgroundColor | string

white | no | Component background color | black | | enableSwipeDown | boolean | no | Enable swipe down to close image viewer. When swipe down, will trigger onCancel. | false | | swipeDownThreshold | number | no | Threshold for firing swipe down function | | | doubleClickInterval | number | no | Double click interval. | | | pageAnimateTime | number | no | Set the animation time for page flipping. | 100 | | enablePreload | boolean | no | Preload the next image | false | | useNativeDriver | boolean | no | Whether to animate using useNativeDriver | false | | menus | function

({cancel,saveToLocal}) => React.ReactElement<any> | no | Custom menus, with 2 methods:cancel to hide menus and saveToLocal to save image to camera | menuContext | object

{someKey: someValue} | no | Custom menu context. | { saveToLocal: 'save to the album', cancel: 'cancel' }

Development pattern

Step 1, run TS listener

After clone this repo, then:

npm install
npm start

Step 2, run demo

cd demo
npm install
npm start

Then, scan the QR, use your expo app.

Dependence

Depend on react-native-image-pan-zoom: https://github.com/ascoders/react-native-image-zoom