How to create a image of a HDD without the unallocated space?

As the partitions are both at the front of the disk, you could just image that portion of the disk.

Try using dd:

dd if=/dev/sdb of=image.dd bs=4M count=54058286592 iflag=count_bytes

Here, count is equal to the number of bytes to be imaged - parition 2's end, ×512 (size of a sector).

To then allow a larger block size (increase transfer rate), you must indicate that your count argument is in "bytes" and not "input blocks" (as it would be by default) - use iflag=count_bytes.