1. Overview
In this tutorial, we’ll discuss how to convert CUE, BIN, and IMG images to an ISO file. We’ll also see how to combine multiple images and create a single ISO out of them.
For this task, we’ll take a look at different utilities such as iat and bchunk.
2. bchunk
The bchunk utility converts BIN and IMG CD images to ISO tracks. The track contains an ISO filesystem that we can mount as a loop device on Linux.
2.1. Installation
bchunk isn’t available on most Linux distributions by default. However, we can install it from our distribution’s official package repository using the name bchunk.
On Debian and Ubuntu-based distributions, we can use apt:
$ apt install bchunk
On RHEL and Fedora, we can use yum:
$ yum install bchunk
Once bchunk is installed, we can use the utility via the bchunk command.
2.2. Converting a Single CD Image to an ISO Image
bchunk follows a straightforward syntax:
$ bchunk myimage.img myimage.iso
Similarly, we can specify the CUE and BIN images as well. However, we should know that if our BIN image contains any CD-Audio tracks, then bchunk will fail to convert it.
The reason for this is that the CD-Audio data structure is incompatible with the ISO file system. In this scenario, we can consider using other utilities like bin2iso.
2.3. Combining Multiple CD Images Into a Single ISO Image
We can pass in multiple images as input to create a single ISO out of them:
$ bchunk *.cue *.img final.iso
3. iat
iat is a convenient utility for analyzing and detecting the structure of popular image formats. Not only that, but it can also convert the supported images into an ISO-9660 image format.
Besides the ISO-9660 format, it also supports BIN, MDF, PDI, CDI, NRG, and B51 formats.
3.1. Installation
iat doesn’t come preinstalled on most Linux distributions. However, we can install it from our official package repository.
On Ubuntu-based distributions, we can install using the package name iat:
$ apt install iat
Similarly, on Fedora and RHEL, we can use yum:
$ yum install iat
Once installed, let’s verify it:
$ iat --version
Iso9660 Analyzer Tool v0.1.7
3.2. Converting Images to an ISO-9660 Image
We can simply specify the input and output image file to iat:
$ iat --iso -i file.img -o file.iso
Let’s understand the command’s arguments:
- -i signifies the input image
- -o signifies the output image
- –iso option indicates that we’re converting the image to ISO-9660 format
4. Difference Between ISO and IMG
If we’re dealing with an IMG image file, we should know that there is no fundamental difference between the ISO and IMG structure if the IMG file is uncompressed. The only difference between them is the extension.
Therefore, we can simply treat an uncompressed IMG file as an ISO file by changing its extension:
$ mv file.img file.iso
Then, we can use ISO software to access the data inside the image. For instance, we can mount the image and read data from it:
$ mount -o loop ~/file.iso /media/mount_point
5. Conclusion
In this article, we learned how we can convert CUE, BIN, and IMG image formats to the standard ISO-9660 format. First, we looked at the bchunk utility to convert single and multiple images. Then, we discussed the iat utility as an alternative to the bchunk utility.
Finally, we saw that there’s no difference between the ISO and IMG formats apart from the file extension.