Save all images using names of materials
The following script should resave your images the way you want. Copy and paste this into blenders text editor and click Run Script.

If the same image is used by multiple materials, it will save a copy of the image for each material but only one will be used for all materials.

import bpy
import os

editor = bpy.context.screen.areas[1]
old_type = editor.type
editor.type = 'IMAGE_EDITOR'
override = bpy.context.copy()
override['area'] = editor

def rename_image(img, mat_name, img_count):
    editor.spaces.active.image = img
    fp = bpy.path.abspath(img.filepath)
    pardir = os.path.dirname(fp)
    sufx = fp.split('.')[-1]
    if img_count &gt; 1:
        img_name = mat_name + '_' + str(img_count)
    else:
        img_name = mat_name
    img.name = img_name
    new_path = os.path.join(pardir, img_name + '.' + sufx)
    bpy.ops.image.save_as(override, filepath=new_path)

for mat in bpy.data.materials:
    mat_imgs = 0
    if mat.use_nodes:
        nt = mat.node_tree.nodes
        for n in nt:
            if n.type == 'TEX_IMAGE':
                mat_imgs += 1
                rename_image(n.image, mat.name, mat_imgs)
    else:
        for s in mat.texture_slots:
            if s is not None and s.texture.type == 'IMAGE':
                mat_imgs += 1
                rename_image(s.texture.image, mat.name, mat_imgs)

editor.type = old_type