Python api for parsing image sequences?

I was looking around, hoping to find a python library I could use that would give me access to tools related to parsing frameranges. Ideally I'd love to feed it a list of filenames, be able to query the condensed notation (i.e. filename.1-100x5@@@.exr), and then be able to perform an intersection between two such ranges (i.e. the intesection of filename.1-100x5#.exr and filename.20-300#.exr would give me filename.20-100x5#.exr).


I know it's a bit of a long shot, but is anything like that available for public consumption? Thanks!

댓글 3개

  • 0
    Jon Morley

    Hi Aaron,

    Are you trying to do this from within RV in a Python package? If so then you can use commands.contractSequences and commands.existingFramesInSequence like so:

    seq1 = commands.contractSequences(["filename.0001.exr, filname.0006.exr, ... , filename.0100.exr])
    seq2 = commands.contractSequences(["filename.0020.exr, filname.0021.exr, ... , filename.0030.exr])

    frames1 = commands.existingFramesInSequence(seq1)
    frames2 = commands.existingFramesInSequence(seq2)

    sharedFrames = set(frames1).intersection(set(frames2))

    finalSeq = commands.contractSequences(["filename.%d.exr" % frame for frame in sharedFrames])

    That should work, but I just typed that off the top of my head. There might be a typo or two in there. If you are trying to do this outside of RV then it will not work.


  • 0
    Aaron Wilson

    Thanks, Jon! I was trying to do this outside of rv for now, and was hoping that this library would be available to any python session with the right path, but it sounds like that's not the case. Again, I figured it was a long-shot to begin with. :) Thanks for the quick response!

  • 0
    Jon Morley

    Ah, gotcha. Good luck!

댓글을 남기려면 로그인하세요.