Android - How to use *.img file instead of *.gz (or *.pit) file with Heimdall?

Newer versions of Heimdall will accept a .img file for the --RECOVERY parameter and automatically download a PIT from the device to add the img contents to.

$ heimdall flash --RECOVERY recovery.img 
Heimdall v1.4.1

[trimmed some output here]

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading RECOVERY
RECOVERY upload successful

Ending session...
Rebooting device...
Releasing device interface...
Re-attaching kernel driver...

If you use Linux - download heimdall-frontend so you can use GUI. It is much easier.

To flash using Heimdall you first need to specify .pit file.

.pit stands for Partitions Information Tables, so Heimdall knows where it need to flash it.

To flash TWRP using Heimdall follow this steps:

  1. Open Heimdall frontend.
  2. Go to Utilities tab.
  3. You will see Download PIT. Go Save As and save it on some location.
  4. Go to Flash tab.
  5. In PIT category, click Browse and select PIT file you downloaded from device in step 3.
  6. Click Add button.
  7. For partition name select where you want to flash it. BE CAREFUL! If you flash it on wrong partition you can perma-brick device. On my device for recovery it is Kernel2.
  8. Go Browse for file and select .img file.
  9. In Session let everything unchecked.
  10. Click Start.

Note2: This can brick device, be careful, here on site, we do NOT hold responsibility for your device.
Note3: If you're on Windows, just use Odin...