If you have a free blog hosted to wordpress.com and you want to move it to another domain, or if you want to have a local backup to your PC, you will see that you can't download your entire media library.
You only can download the entire xml export file and by using the WP import plugin, to import every data including your images, but sometimes and especially if you have thousands of images, WP importer doesn't import everything.
This is a problem I had in some blogs I asked to help for, so I wrote this simple script to do this job.
No go to your wordpress.com admin panel and select Tools -> Export.
From there, select "Media" and click on "Download" Button.
Unzip the file you received from WordPress and upload/move it in the folder you have the "index.php" file. Now open the "index.php" file with a txt editor and at the line 32, enter the filename of your xml file, eg: "myxmlfile.wordpress.post_type-attachment.001.xml".
If you have multiple xml files, wait until all the images of every file have been copied, and then change the settings and continue with another xml file.
Point your browser to this file, for example: http://localhost/index.php and wait for it to finish. If the browser freeze or you see no other folders/images inside the folders but the icon of your browser working, you can close this tab and re-run it again. Don't worry, it will skip the photos that already have been copied.
When done, you should have your photos in an "uploads" folder. You can upload this folder to your wordpress uploads folder or keep them as a backup.
Your blog must be visible in order this script to work.
Note that this script is for wordpress.com hosted blogs. You can install plugins like this, for your own hosted WordPress blog. However, if you do the same steps, it should work on every WordPress media library.