LoginSignup
7
7

More than 5 years have passed since last update.

pythonista3で写真をディレクトリに保存

Last updated at Posted at 2019-01-10

pythonista3 凄いじゃん _(´ཀ`」 ∠)

まじで色々できるし、初めからExampleにステキなサンプルはいってるし…
1200円はやすいぐらいでは(べた褒め)

でも、カメラロールの写真の使い方がいまいち分からなかったので、保存する用のスクリプト書きました

ソースコード

#coding:utf-8
import photos

# AssetCollectionリストからカメラロールを取得する
for album in photos.get_smart_albums():
  if album.title == 'All Photos':
    camera_roll = album
    break

#画像を一つだけ取得する
asset = photos.pick_asset(camera_roll)
img = asset.get_image()

#img.show()
img.save("photo.png") #任意の名前とディレクトリ
  • img.save()の中身を ../ とか突っ込むとディレクトリを自由自在に移動できるのデス

  • iosのアプリ開発これでよくね?

参考にさせていただいたサイト

Pythonista 3でフォトライブラリの読み書き

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7