here is some code i started when i had the same idea of turning a directory full of images into wordpress posts each containing just the image and having the image name as title.
hope you can use it as a starting point to improve on.
the code expects the folder to be at the root of your wordpress installation – example folder is ‘gallery’ – if your wordpress is installed at http://www.yoursitename.com/wordpress – then the image folder should be at http://www.yoursitename.com/wordpress/gallery .
no guarantee that i will work
far from perfect:
it saves the posts as draft; change it here to publish when you need it:
$my_post['post_status'] = 'draft'; // or 'publish'
i inserted the code into functions.php, and removed the comment slashes // from the function call at the end of the code; saved it – that would then create the posts; then edited it and put the comment slashes back.
the code also echoes the image file information and the posts names when successfully generated, just infront of the theme.
i also added
sleep(1); //wait 1 second between posts
at the end of the function to avoid the sequence of posts to be mixed; remove it if that does not matter (would atherwise take a long while to finish with 400 posts).
hope this all made some sense, good luck 😉