One way to detect malware in image files is by scanning the file with antivirus software. This is the most reliable method, as the software is specifically designed to identify and remove malware from your computer.
However, changing the file extension of an image file (e.g. from .jpg to .pdf) will not prevent the file from potentially containing malware. Malware can be embedded in any type of file, regardless of its extension.
If you are concerned about downloading potentially malicious image files, it is best to avoid downloading images from untrusted sources. Instead, you can try using a reputable online image library, such as those provided by Microsoft or Google, which often have a large selection of high-quality, safe images.
Additionally, you can consider using a virtual private network (VPN) to encrypt your internet connection and protect yourself from potential malware when downloading images from the internet.