Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
RAW + JPEG
-
Is there any way that I can use pythonista to comb through my photos and remove the RAW component to a RAW + JPEG that are imported to photos via SD dongle? I envision this leaving the JPEGs as is.
The Why:
- I shoot RAW + JPEG because my camera has a built in raw converter that I can do a quick edit and render a new JPEG. If I could choose to only import JPEGS only I would just do that, but silly iPad isn't that bright. So both the RAW and JPEG are imported taking significant space. If I could run a little pythonista script to remove the raw file that would be great. I'm fairly familiar with photos assets - but haven't seen anything to separate a raw from jpeg and then remove that.
Thanks for your help!
-
The photos module might be of some help. You can get an albumn, or all assets, then use
delete
on an asset to delete it.It looks like you can use objc_util for determining if an asset is raw:
import photos from objc_util import * for a in photos.get_assets(): if ObjCInstance(a).isRAW(): a.delete() print('deleted ', a)
There may be less brute force ways (searching a single album, rather than all)
You shoudl probably test this on something you dont care about, to verify that the raw and jpeg get separate assets....
-
I think RAW+JPEG are typically represented as one asset with two
PHAssetResource
s. Asset resources are not supported (bridged) in thephotos
module, so you would have to work with the Objective-C APIs directly, usingobjc_util
, but I'm frankly not sure how you could delete an asset resource. Haven't found much about this by googling. -
Awesome thanks guys. The Photos module I was playing around with and couldn't find a way. I'm not at all familiar with objc_util. So, time to learn! Thanks for the example. I'll play around and if I can make an elegant (-ish) way I'll post it back here.