VOOZH about

URL: https://www.geeksforgeeks.org/reactjs/create-an-image-to-text-app-using-react-native/

⇱ Create an Image to Text App using React-Native - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Create an Image to Text App using React-Native

Last Updated : 23 Jul, 2025

In this article, we are going to build a step-by-step Image to Text app using React-Native. This application will allow users to extract the text from the image using OCR (Optical Character Recognition) and later copy it to the clipboard or share it with others. This application is a perfect usage of React Native as the perfect framework for application development. The application will allow the user to either pick an image from the gallery or click a photo using the camera implemented in the application. Later the image will be shown and a Text component will display the extracted text.

Preview Image:

👁 Screenshot-2023-09-22-221722

Prerequisites

Project Setup

Step 1: Create the project

npx create-expo-app image-to-text-app

Step 2: Navigate to the project

cd image-to-text-app

Step 3: Install the expo-location package.

npx expo install expo-image-picker

Project Structure:

👁 Screenshot-2023-09-16-115619

Here's package.json file for dependencies and respective versions.

{
"name": "image-to-text-app",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "~49.0.11",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-native": "0.72.4",
"expo-image-picker": "~14.3.2"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}

Approach

  • In this application, we use an API for image-to-text. Create a free account and get the API key
  • Next, we use expo-image-picker to pick the image from gallery and send the file to perform OCR.
  • The performOCR function gets the file as argument and then performs fetch POST operation, and saves the text to a variable.
  • The image and the text is displayed.

Example: This example shows the use of the above-explained approach.

Step 4: Run the application

npx expo start

Step optional: To run on Web, you need to install the following packages

npx expo install react-dom react-native-web @expo/webpack-config

Step 5: To run on web, press w on Terminal will application is running. For Android/IOS, install the Expo app and scan the QR code or enter the link of Metro in the Terminal.

Output:

Comment