2
$\begingroup$

I'm trying to know if a blend file contains images and if it contains to unpack the images out to the directory. So just before I'm running this line: bpy.ops.file.unpack_all(method='USE_ORIGINAL') to ask if this blend file is with packed images.

$\endgroup$
2
$\begingroup$

Image.packed_file

Look at the value of the Image.packed_file property. Will be None if not packed.

Console test.

>>> for i in bpy.data.images:
...     i.name, i.packed_file
...     
('3cb598.jpg', bpy.data.images['3cb598.jpg']...PackedFile)
('3b17ebcf9eb9.jpg', None)
('huge.49.247445.JPG', bpy.data.images['huge.49.247445.JPG']...PackedFile)
('Render Result', None)

>>> 
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanx @batFINGER :) it's exactly what I need. $\endgroup$ – greenrod Oct 30 '17 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.