You'll need to think about what you do and don't want to rewrite then, and come up with a comprehensive list.
Remember that it is the client (browser) that requests images, CSS, external JS, etc., and that it requests them by the URLs where *it thinks* they are. So, if you are using relative links, the browser will build the link from the URL it sees (in the address bar) for the current page, and not using the internally-rewritten URL, which it can't see.
I'm not sure if your problem is that these broken images are being rewritten when they should not be, or if they need to be rewritten and are not being rewritten. But either way, you need to tightly define what is and is not to be rewritten, and then modify the code to do that.
You must define the problem in terms related to the URLs. For example, "Don't rewrite if the URL ends in '.gif'" or "Rewrite if the URL contains underscores but no slashes, and only if it ends with '.html'" -- stuff like that. You can base the decision on the types of characters in the URL, the filetype of the URL, the number of slashes in the URL -- a whole host of patterns that can be tested for. But it's all based on the URLs, so it can be difficult if your URLs are not laid out on a well-defined 'plan.'
In case this is a simpler question than I've addressed, to prevent .gif files from being rewritten, just add that to your /help/ exclusion: