There are 3 basic types of malware:
- Malware that exploits the user
- Malware that exploits bugs
- A combination of 1 and 2
Your type of malware is at least 2 or 3 so in order to actually do anything, it needs something to exploit.
The file is opened for reading and some code is executed parsing the file. Thus, in theory, if the virus exploits a bug in the file-opening or reading/parsing code, yes it could hijack that process without being actually run and do whatever it wants with the rights of the one who right-clicked it.
But this was probably not the only time the file was opened & read:
- Your AV has hopefully scanned the file
- Possibly Windows opened it to read some data it displays even without you right-clicking, such as some Exif-data or a thumbnail
But given that file reading and parsing are quite basic things that are even essential to AVs it's quite likely that most bugs are ironed-out of this part of the OS, otherwise your Virus would pretty much be the "Super-Virus" no AV could do anything against.
All in all I doubt that the virus is exploiting such a critical bug but more likely something more sophisticated and specific for JPG-display that's triggered when eg. rendering the file in program X.