Canon DSLRs appear to save photos in landscape orientation and uses exif::orientation to do the rotation.
exif::orientation
Question: How can imagemagick
Use the auto-orient option of ImageMagick's convert to do this.
convert
convert your-image.jpg -auto-orient output.jpg
Or use mogrifyto do it in place
mogrify
mogrify -auto-orient your-image.jpg