如何使用 Java 从 Picasa Web API 下载图像

发布于 2024-10-08 20:58:56 字数 189 浏览 0 评论 0原文

Google 的开发者指南介绍了如何上传照片到 Picasa网络相册,但是如何用 Java 下载图像文件以便将其保存在本地计算机上?

Google's developer guide explains how to upload photos to the Picasa Web Albums, but how do I download the image file in Java so that I can save it on my local machine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

み青杉依旧 2024-10-15 20:58:56

我对 Picasa 网络相册 API 不太熟悉,但我认为只需查看 Javadocs 就可以实现:

// read all photos from an album
URL feedUrl = "https://picasaweb.google.com/data/feed/api/user/username/albumid/albumid";

AlbumFeed feed = myService.getFeed(feedUrl, AlbumFeed.class);

for(PhotoEntry photo : feed.getPhotoEntries()) {
    MediaSource mediaSource = photo.getMediaSource();
    InputStream photoInputStream = mediaSource.getInputStream();
    // read from the photoInputStream here to get contents of photo
}

I don't really have any familiarity with the Picasa Web Albums API, but this is what I think may work by just looking at the Javadocs:

// read all photos from an album
URL feedUrl = "https://picasaweb.google.com/data/feed/api/user/username/albumid/albumid";

AlbumFeed feed = myService.getFeed(feedUrl, AlbumFeed.class);

for(PhotoEntry photo : feed.getPhotoEntries()) {
    MediaSource mediaSource = photo.getMediaSource();
    InputStream photoInputStream = mediaSource.getInputStream();
    // read from the photoInputStream here to get contents of photo
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文