Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
How can I convert image uri (not url) to base 64 in JavaScript

I'm trying to create a mobile application with react native and expo for the machine learning classification image. My application take photos from the camera and send the PhotoUri to a function that return the prediction. How can I convert the image uri to base 64 string?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The easiest way is to use the official expo-image-picker. The package offer option to capture image via camera or load them from the media library

import * as ImagePicker from 'expo-image-picker'

  const pickImage = async () => {
    // No permissions request is necessary for launching the image library
    let result = await ImagePicker.launchCameraAsync({
      mediaTypes: ImagePicker.MediaTypeOptions.All,
      allowsEditing: true,
      aspect: [4, 3],
      quality: 1,
      base64:true // Return base64 image data
    });

    console.log(result);

    if (!result.cancelled) {
      //
    }
  }

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!