Whether you're rooting a phone, fixing a bootloop, or building a repair library, you often need just the boot.img or recovery.img from a full stock ROM — not the whole firmware. Extracting these individual images lets you patch, restore, or flash a single partition without touching the rest. This guide covers how to pull boot and recovery images from every common firmware format.

The boot image contains the kernel and ramdisk that start Android; the recovery image runs the recovery environment. Being able to extract them cleanly is a core skill for rooting (Magisk patches boot.img), for fixing a broken recovery, and for restoring a single partition after a bad flash.

Why Extract Individual Images?

Instead of reflashing an entire ROM, extracting a single image lets you:

  • Patch boot.img with Magisk for root
  • Restore a corrupted recovery without a full flash
  • Fix a bootloop by reflashing only boot
  • Build a per-model library of boot/recovery images for fast repairs

It's faster, safer, and preserves user data compared to a full flash.

Firmware Formats and Their Tools

Different brands package firmware differently, so the extraction tool depends on the format:

  • MediaTek (scatter + .img): boot and recovery are already separate .img files in the folder — no extraction needed.
  • Samsung (AP tar.md5): boot.img and recovery.img are inside the AP file, which is a tar archive.
  • Qualcomm (payload.bin or .img): images may be separate or packed in payload.bin.
  • .ozip / .ofp (Oppo/Realme/Transsion): need a specific decryption/extraction tool.
  • A/B devices (payload.bin): use a payload dumper.

What You Will Need

  • A Windows PC (or Linux/Mac for some tools)
  • The full stock ROM for your model
  • Extraction tools: 7-Zip, payload-dumper-go, Samsung firmware/tar tools, or format-specific extractors
  • Basic familiarity with file archives

Method 1: MediaTek — Already Separate

For most MediaTek firmware, open the firmware folder and you'll find boot.img and recovery.img directly. Just copy the one you need — no extraction required.

Method 2: Samsung — Extract from AP tar.md5

  1. Open the AP_xxxx.tar.md5 file with 7-Zip.
  2. Inside, find boot.img.lz4 and recovery.img.lz4.
  3. Extract them, then decompress the .lz4 files (using an lz4 tool) to get the raw boot.img and recovery.img.

Method 3: payload.bin (A/B Devices)

Many modern phones ship firmware as payload.bin:

  1. Get payload-dumper-go (or a Python payload dumper).
  2. Run it against payload.bin.
  3. It extracts every partition, including boot.img and recovery.img (or vendor_boot).

Method 4: .ozip / .ofp (Oppo, Realme, Transsion)

These encrypted formats need a dedicated extractor (an ozip decryptor or an ofp extraction tool for MTK/Qualcomm variants). Run the tool on the firmware file to unpack the partitions, then grab boot or recovery.

Step-by-Step: A Typical Extraction

  1. Identify the format of your firmware (scatter, tar.md5, payload.bin, ozip/ofp).
  2. Choose the matching tool from the methods above.
  3. Extract the archive.
  4. Locate boot.img and recovery.img (decompress .lz4 if Samsung).
  5. Verify the file size is reasonable (boot images are usually tens of MB).

Common Problems and Fixes

Only .lz4 files inside Samsung AP. Normal — decompress them to get raw .img.

payload dumper errors out. Wrong tool version or corrupt payload. Re-download and use the current dumper.

.ozip won't open in 7-Zip. It's encrypted — use a dedicated ozip decryptor, not a normal archiver.

Extracted image won't flash. Wrong slot (A/B) or model mismatch. Use the image from the exact firmware for your device.

Best Practices

  • Match the image to the exact model and version you'll flash it to.
  • Keep a labeled library of boot/recovery images per model.
  • For root, always patch the stock boot.img from the exact build on the phone.
  • On A/B devices, mind the active slot when flashing back.

Pro Tips From the Workbench

The most common rooting mistake is patching a boot.img from the wrong build. Magisk needs the boot image from the exact firmware version currently on the phone — even a minor build difference can cause a bootloop. Always confirm the phone's build number, download that precise firmware, and extract boot.img from it before patching.

For shops, an organized boot/recovery image library is a quiet superpower. When a customer arrives with a bootlooping phone, having the exact boot.img ready means you can reflash a single partition in seconds and often save their data, instead of doing a full wipe-and-flash. Label everything by model and build.

On modern A/B devices, remember there's no separate recovery partition on many models — recovery lives inside boot or vendor_boot. Extract the right one, and when flashing back, target the correct active slot or you'll appear to flash successfully with no effect. Finally, keep payload-dumper-go and 7-Zip on every repair PC; between them they handle the large majority of firmware formats you'll meet.

Frequently Asked Questions

Why extract boot.img instead of full flashing? It's faster, preserves data, and is exactly what root (Magisk) and single-partition fixes need.

Where is boot.img in Samsung firmware? Inside the AP tar.md5 as a .lz4 file — extract and decompress it to get the raw image.

What is payload.bin? The firmware package format on many A/B devices; a payload dumper extracts boot, recovery, and other partitions from it.

Can I open .ozip with 7-Zip? No — it's encrypted and needs a dedicated ozip decryptor.

Do A/B phones have a recovery partition? Often not separately — recovery is inside boot or vendor_boot. Extract accordingly.

Quick Reference Checklist

Match the format to the tool:

  • MediaTek: boot.img and recovery.img are already separate — just copy.
  • Samsung: open AP tar.md5 in 7-Zip, extract boot.img.lz4 / recovery.img.lz4, then decompress the .lz4.
  • A/B devices: run payload-dumper-go on payload.bin to extract every partition.
  • Oppo/Realme/Transsion: use an ozip/ofp decryptor — a normal archiver won't open encrypted files.
  • For root: always patch the boot.img from the exact build currently on the phone.
  • A/B note: recovery often lives inside boot/vendor_boot; flash the correct active slot.

Keep 7-Zip and payload-dumper-go on every repair PC — between them they handle nearly every firmware format you'll meet, and a labeled per-model image library saves data on future bootloop jobs.

What tool decompresses Samsung .lz4 files? A small command-line lz4 utility (or a GUI archiver that supports lz4) turns boot.img.lz4 into a raw boot.img. Some all-in-one Samsung firmware tools do it automatically during extraction.

Can I extract vbmeta or dtbo the same way? Yes. The same methods — 7-Zip for Samsung AP, a payload dumper for payload.bin — extract vbmeta, dtbo, and other partitions alongside boot and recovery.

A Note on Responsible Use

Extracting and flashing partition images should be done only on devices you own or are authorized to repair. Use official firmware from trusted sources, and always extract the boot image from the exact build on the target phone to avoid bootloops.

Conclusion

Extracting a boot or recovery image depends on the firmware format: MediaTek ROMs already have them separate, Samsung packs them as .lz4 inside the AP tar, and A/B devices use payload.bin with a dumper. Identify the format, use the matching tool, and for root always patch the exact-build boot.img. Keep a labeled image library, and you can fix bootloops and root phones without unnecessary full flashes.