def METHOD_NAME(app):
    app.build()
    tree = app.env.get_doctree('images')
    htmlbuilder = StandaloneHTMLBuilder(app, app.env)
    htmlbuilder.init()
    htmlbuilder.imgpath = 'dummy'
    htmlbuilder.post_process_images(tree)
    assert set(htmlbuilder.images.keys()) == \
        {'subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg', 'img.foo.png'}
    assert set(htmlbuilder.images.values()) == \
        {'img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'}
    latexbuilder = LaTeXBuilder(app, app.env)
    latexbuilder.init()
    latexbuilder.post_process_images(tree)
    assert set(latexbuilder.images.keys()) == \
        {'subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
         'svgimg.pdf', 'img.foo.png'}
    assert set(latexbuilder.images.values()) == \
        {'img.pdf', 'img.png', 'img1.png', 'simg.png',
         'svgimg.pdf', 'img.foo.png'}