RewriteEngine on
RewriteRule ^([0-9]+).jpg index.php?id=$1 [L]