Code Monkey home page Code Monkey logo

Comments (5)

cgohlke avatar cgohlke commented on June 15, 2024 1

I actually know the total number of frames. In this case, is it possible to write chunks of frames at once to the same series (not frame by frame)?

If you don't need the tifffile metadata, try:

with TiffWriter('video.tif') as tif:
    for chunk_of_frames in video:
        tif.save(chunk_of_frames, contiguous=True, metadata=None)

Otherwise provide a generator of frames (not tested):

def frames():
    for chunk_of_frames in video:
        for frame in chunk_of_frames:
            yield frame

imwrite('video.tif', frames(), shape=video.shape, dtype=video.dtype)

from tifffile.

cgohlke avatar cgohlke commented on June 15, 2024

If the number of frames is unknown before, the only way to achieve that is to write frame by frame to an open TiffWriter instance in contiguous mode:

with TiffWriter('video.tif') as tif:
    for frame in video:
        tif.save(frame, contiguous=True)

from tifffile.

alejoe91 avatar alejoe91 commented on June 15, 2024

@cgohlke thanks for the quick reply!

I actually know the total number of frames. In this case, is it possible to write chunks of frames at once to the same series (not frame by frame)?

from tifffile.

alejoe91 avatar alejoe91 commented on June 15, 2024

Thanks! I'll try these solutions and let you know :)

from tifffile.

alejoe91 avatar alejoe91 commented on June 15, 2024

The first solution did the trick :)

Thanks!

from tifffile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.