If for some reason you want to find the version of a keknel image file. For example, i was curious after compiling during a Gentoo install.
Usage:
File is just the code, please run before executing:
gcc -o kver kver.c
Then run:
./kver [path to Kernel image file]
Admittedly stolena bit ago from a Stackoverflow answer, will link for credit if I can find it again. Just thought this would be useful to have in the arsenal.