I modified MAME v0.128 (debug version) to allow to save the tiles and palettes:
http://pagesperso-orange.fr/franck.charlet/mamed_ts.zip
In the palette view using 'S' key will create a directory (if necessary) with the current game name & save the current palette into it as a .pal file.
In the tiles view using 'S' key will create a directory (if necessary) with the current game name & save all the tiles with all the possible palettes.
I also added a 'windowzoom' option in mame.ini to allow to magnify the window when it's not maximized or in full screen mode, this can be used to obtain a bigger window without the distorted pixels.
Here is an example with tiles and sprites from the game Side Arms (converted to .png):
http://pagesperso-orange.fr/franck.charlet/sidearms.zip
As you can see, all different possibilities are saved side by side as .bmp format (files are optimized during saving but can become pretty big anyway, so beware), the layout (number of tiles/row) follows the one chosen by the user.
Notice that the files can be saved several times during a session without the older ones being overwritten (new ones will be created with different numbers), i implemented it that way because sometimes it's necessary due to changes in the palette (mostly between game levels).
What's left is to spot in games which tiles or sprites are used with what palette and to keep the right ones, it's not perfect but it makes ripping gfx from arcade games it a lot easier than before.