Download original pictures from the picasaweb

Even the google picasaweb API support up to 1600×1200, we can grab the original pictures by changing the URL of the picture.

20th line is the highlight. I found this hack after googling, but I forgot the URL. -_-

First you should have python and install the Google Data Library

Don’t forget to change the USER_ID and USER_PASSWORD with yours.

#!/usr/bin/env python

import gdata.photos.service
import gdata.media
import gdata.geo
import urllib
import os
import sys

URL_TO_GET_PHOTOS 	= '/data/feed/api/user/default/albumid/%s?kind=photo'
URL_TO_GET_TAGS 	= '/data/feed/api/user/default/albumid/%s/photoid/%s?kind=tag' 
URL_TO_GET_COMMENTS	= '/data/feed/api/user/default/albumid/%s/photoid/%s?kind=comment'

# Change the followings with yours
USER_ID				= 'YOUR_GMAIL_ID'
USER_PASSWORD		= 'YOUR_GMAIL_PASSWORD'


def download_file( url, dir_name ):
	"Download the data at URL to the current directory"
	basename = url[url.rindex('/') + 1:] # figure out a good name for the downloaded file.
	url = url.replace(basename, "d/"+basename)

	urllib.urlretrieve(url, dir_name+"/"+basename)

def connect_to_picasa( name, password ):
	gd_client = gdata.photos.service.PhotosService()
	gd_client.email = USER_ID
	gd_client.password = USER_PASSWORD
	gd_client.source = 'api-sample-google-com'
	gd_client.ProgrammaticLogin()

	return gd_client

def get_album_list( gd_client ):
	return gd_client.GetUserFeed()

def print_photo_list( albums ):
	for album in albums.entry:
		downloaded_photos = 0
		print 'Album: %s (%s)' % (album.title.text, album.numphotos.text)

		if not os.path.exists(album.title.text) :
			os.mkdir(album.title.text)

		photos = gd_client.GetFeed(URL_TO_GET_PHOTOS % (album.gphoto_id.text))

		for photo in photos.entry:
			download_file( photo.content.src, album.title.text )
			downloaded_photos += 1

			sys.stdout.write("\t%d/%s  %.1f %%\r" %(downloaded_photos, album.numphotos.text, 100.0*downloaded_photos/eval(album.numphotos.text)))
			sys.stdout.flush()

		print ""
		

if __name__ == '__main__':
	gd_client = connect_to_picasa( USER_ID, USER_PASSWORD )
	albums = get_album_list( gd_client )
	print_photo_list( albums )
	

18 responses to “Download original pictures from the picasaweb

  1. Hello Cychong,

    thanks for your comment on my blog. Unfortunately I have not published it because in my post I write specifically about getting original photos from Picasaweb without having to install any scripts or additional software. The intention behind this is to make it as easy as possible for all level experience users to get the original photos and I am not sure if noobs will understand Python or your script.

    I must say though that your script looks intriguing and I will give it a try. Thanks so much! If you check online you will find many more Python and other scripts to get the original photos and perhaps it would be better to post a comment on posts specifically talking about scripts to download the original photos.

    I hope you do understand my point here are don’t hold it against me. Your blog is really interesting and I have bookmarked it, the design/theme you picked is also very neat and tidy compared to my still quite messy theme. I am working on a minimal blogger theme at the moment. It would be great to hear back from you.

    All the best!
    Telux

    • Hi,

      I understand your intention – not install anything at all. I use Mac OS X. Therefore I think installing only the gdata is pretty trivial(I have used *nix for more than 10 years. So I think everyone is good at using *nix -_-).

      One more thing, I try to find to get the script which download the original pictures. But I can not. All the script I found just getting up to 1600×1200.

      Anyway thanks for the comment. :-)

  2. Dear Cychong,

    I have given this some thought and have a proposition for you.

    First of all why is it not possible to download the photos without giving one’s personal USER_ID and USER_PASSWORD? I am sure there is lots of people that either do not want to give their details or otherwise don’t have a Google/Picasaweb account at all. Can you fix that?

    Then I would like to ask you if you could include the option in your script to not only download all the original photos from one album but also give the user the option to download all the albums from a particular Picasaweb user in original size?

    Ideally it would be great if you could write it so that the user is being asked to what drive and what directory the albums and photos are being saved and then download the albums and save them with the original album names.

    Additionally if you can make the album option so that the user can select what albums from an account she/he wants to download, instead of only having the option to download them all that would be great.

    If you manage to include these options in your script I am more than happy to write up a detailed tutorial on how to install Python, the Google Data Library and last not least your script. Of course I will mention your site and credit your work and together we can help users getting albums and photos from Picasaweb in original full size.

    Are you in? Does something like that interest you? I think it would be great and with a detailed tutorial I think also inexperienced users would sure give it a try.

    Most important like this Mac users that do not like to install Firefox and DownThemAll! can use such a method as well and so benefit as well.

    Thanks so much for your reply, hope to hear from you soon.

    Regards,
    Telux

    • cychong

      Hi, Thanks for the suggestion.
      I add my answer in your comments. Please see the comments.

      Dear Cychong,

      I have given this some thought and have a proposition for you.

      First of all why is it not possible to download the photos without giving one’s personal USER_ID and USER_PASSWORD? I am sure there is lots of people that either do not want to give their details or otherwise don’t have a Google/Picasaweb account at all. Can you fix that?
      >> The ID and password is required to access photo of ‘ID’
      >> Basically the picasaweb API is intended to access galler of ‘ID’ and it need the login procedure definitely.

      Then I would like to ask you if you could include the option in your script to not only download all the original photos from one album but also give the user the option to download all the albums from a particular Picasaweb user in original size?
      >> I think the above answer applies here too.

      Ideally it would be great if you could write it so that the user is being asked to what drive and what directory the albums and photos are being saved and then download the albums and save them with the original album names.
      >> It is not difficult to add this feature. Just prompt to get the destination.

      Additionally if you can make the album option so that the user can select what albums from an account she/he wants to download, instead of only having the option to download them all that would be great.

      If you manage to include these options in your script I am more than happy to write up a detailed tutorial on how to install Python, the Google Data Library and last not least your script. Of course I will mention your site and credit your work and together we can help users getting albums and photos from Picasaweb in original full size.

      Are you in? Does something like that interest you? I think it would be great and with a detailed tutorial I think also inexperienced users would sure give it a try.
      >> I think your suggestion is about the UI. In CLI software(such as script I posted), we can list all the albums and get the albums from the user. However, the user should type the album name or something else(such as index number assigned to each album by script). It works but it is pretty awkward I think. To provide that kinds of feature, we should think about the GUI.(Actually there are several GUI which use the pyGTK library)

      Most important like this Mac users that do not like to install Firefox and DownThemAll! can use such a method as well and so benefit as well.

      Thanks so much for your reply, hope to hear from you soon.

      Regards,
      Telux

  3. what do you think about my above suggestion?

  4. Here check this site: http://picasawebutility.appspot.com/ and in the username field type “cichamaryjka5″ for example.

    You will see a page with all the albums listed. Without giving a username and password. So it must be possible to acquire a list of all the albums a user has.

    Subsequently it must also be possible to get all original photos from all albums from a user without signing into Picasaweb with a username and password. Of course only the public albums will be displayed!

    So what we need is a GUI where people can type in the username and a list of all public albums will appear. On the above appspot example page not the original photos are downloaded as expected, they are limited to 1200x1600pix.

    Then in that list people can select what albums to download or “select all albums” and download. Then a promt is given to where they should be stored on the drive. Then they will be stored there with subfolders of the album names automatically being generated. All photos will be saved in original size.

    Do you think you can do that? I have given you an email address in the comment form where you can contact me directly. Email me and we can discuss this further. And yes having something like this for Mac users would be great! I have seen similar software but it does not work well and often does not download all photos and of course not in original size and most of all not for the Mac platform.

    Speak soon!

  5. so what do you think? can you do it?

  6. Fantastic script, worked brilliantly for downloading ALL images with original names and album names, where all else failed. Thank you so much!

  7. It’s really a cool and helpful piece of information. I’m glad that you shared this helpful
    info with us. Please stay us up to date like this. Thanks for sharing.

  8. Hi, I desire to subscribe for this website to take newest updates, thus
    where can i do it please help out.

  9. Also visit my web-site; [program do rozliczania pit-ów](http:
    //Chilp.it/b091a0 “program do rozliczania pit-ów”)

  10. Here is my site: pit 0 formularz ([ssas-wiki.com](http://ssas-wiki.
    com/w/Za%C5%82%C4%85cznik_pit_0 “ssas-wiki.com”))

  11. Feel free to visit my blog: [pit 37](http://durl.

    me/5e52mq “pit 37″)

  12. Also visit my homepage [dobry program do pitów](http://qubit.
    kyungnam.ac.kr/guest/4791 “dobry program do pitów”)

  13. Also visit my web page :: formularz pit 37 do pobrania ([Casey](http://clip.
    pikawarnet.com/com_free/12208 “Casey”))

  14. What’s up everybody, here every person is sharing these kinds of experience, so it’s good to read
    this webpage, and I used to go to see this web site every day.

    my weblog: e deklaracje 2013 – [http://miniurl.com/95wI](http://miniurl.
    com/95wI “http://miniurl.com/95wI”) -

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: