Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Saving a large amount of .png images to disk from camera?



  • Hi, I am trying to save a large amount of images (5000ish) to disk.

    Currently, I have a camera running, and when the user presses a button, it saves consecutive QImages into a QVector. Afterwards, I created a QImageWriter object and save it to the harddrive. As you can imagine, saving that many images to disk is quite slow. Does anyone know of a way to make writing to disk faster with png format? The quality is already on the lowest compression (100).

    Thanks!

    • Nevin

  • Lifetime Qt Champion

    Hi
    The disk speed is determined by the actual disk.
    Being SSD or spin disk. So not sure there is anything you can do to
    speed it up.
    Options include using threads as not to block GUI while writing
    but it wont speed up the actual transfer to the hd.

    Since its an app for user, using ramdisk is not an option so im not sure
    there is much to do.

    You could have multiple threads write at the same time ( to different files) and if
    hd can take that payload, that would be faster.



  • Ah yes that is what I figured. Thanks!


  • Lifetime Qt Champion

    @nevind7
    I would inspect the current disk usage when saving.
    If its not saturated, you might save 2-3 image at a time cutting total time
    but if spin disk, it might not give much.



  • Ah okay thank you very much :)


Log in to reply