Add Bulk Dummy Photos to iOS Simulator and Android Emulator

A

When developing mobile applications, it is very useful to have a gallery full of photos, especially for the following scenarios:

  • Image picker tests
  • Multiple photo selection
  • Upload performance tests
  • Infinite scroll tests
  • Cache and memory tests
  • Creating a test environment close to a real user experience

Adding photos one by one takes a lot of time. In this article, I will show how to fill the gallery with hundreds of dummy photos for both iOS Simulator and Android Emulator using only a few commands.

1. Creating Dummy Photos

First, we download high-resolution sample images.

Run the following command in the macOS terminal:

mkdir ~/Desktop/dummy-photos

Then download the sample images:

for i in {1..700}; do
  curl -L "https://picsum.photos/4032/3024?random=$i" \
    -o ~/Desktop/dummy-photos/$i.jpg
done
  • Downloads 700 random images. The number 700 is only an example, you can change it based on your needs.
  • Saves the images into the ~/Desktop/dummy-photos folder
  • Uses image sizes close to a real iPhone camera resolution

2. Importing the Photos

Add Photos to iOS Simulator

xcrun simctl addmedia booted ~/Desktop/dummy-photos/*

booted → means the currently open simulator
simctl addmedia → adds the images directly into the Photos app

Add Photos to Android Emulator

On Android, we first copy the images into the emulator.

adb push ~/Desktop/dummy-photos /sdcard/Pictures/

After that, the Android media scanner should be triggered. This step is important because the Android gallery uses the media database instead of reading the file system directly. After running the media scan, the images will appear in the Gallery / Photos application.

adb shell am broadcast \
  -a android.intent.action.MEDIA_SCANNER_SCAN_FILE \
  -d file:///sdcard/Pictures

With this method, you can create hundreds of sample images on both iOS Simulator and Android Emulator in just a few seconds. It is especially useful for image picker, upload, and gallery performance testing in React Native / Expo projects.

Add comment

Sinan BOZKUŞ

Get in touch

Quickly communicate covalent niche markets for maintainable sources. Collaboratively harness resource sucking experiences whereas cost effective meta-services.