I'd like to create an addon that rewrites all img asset tags to prepend IMGIX base URL (source) and append with a query string for quality setting. Does anyone know of an example addon that's a good starting point?

Normally I'd do a simple .htaccess mod_rewrite but that would break the IMGIX source (which is the same) and I don't want the redirect slowness...