This can be done fairly easily with a shell script.
The idea is straight-forward:
1. Use `file -b` to see what 'type' a file is
2. Assign an 'expected' file extension for each 'type' you want to look for
3. Compare the 'actual' extension against the 'expected' extension.
4. Rename if needed.
I made a zsh shell script which should work with Hazel to do just that. You can find it here:
https://gist.github.com/tjluoma/113ed4b45168a821d42ad7c372028737Let me know if you have questions. (I'm following this thread, so I'll be notified of replies.)
ps - by default, the script only checks for PNG and JPEG/JPG but can be easily extended