Your pathname indicates you're on Windows, where Perl opens files in text mode by default. That means when writing a file it converts every occurrence of 0x0A (LF) in your image to 0x0D 0x0A (CRLF), corrupting your image.
Open the file in binary mode:
$ffh->open("C:/Users/Aamer/Desktop/im.jpg", "wb")