How to tell the resolution of an image file in C/Unix

Install the FFMPEG tool suite and use the ffprobe program.

Example:

% ffprobe -v quiet -show_entries stream=width,height street.jpg
[STREAM]
width=1280
height=960
[/STREAM]
%