grahamrow / Muview2

3D visualization of micromagnetic simulation data from Mumax or OOMMF
GNU General Public License v2.0
41 stars 8 forks source link

Saving image-sequence als png leads to png-files with .jpg extension #24

Closed LukeSkywalker92 closed 7 years ago

LukeSkywalker92 commented 8 years ago

Version: Muview2.1.2-Ubuntu-14.04

When you want to save an image-sequence as png, the result are file with .jpg extension. These files can't be opened, because they're compressed in png-style and your PC thinks they are jpg's.
To open these files you have to rename your files to .png yourself.

I think the bug is located inside this function (Muview2/source/window.cpp):

void Window::saveImageSequence()
{
    QString dir = QFileDialog::getExistingDirectory(this, tr("Save Sequence to Directory"),
        lastSavedLocation.path(),
        QFileDialog::ShowDirsOnly
        | QFileDialog::DontResolveSymlinks);

    if (dir != "")
    {
        connect(viewport, SIGNAL(doneRenderingFrame(QString)), this, SLOT(saveImageFile(QString)));

        lastSavedLocation = QDir(dir);
        QImage screen;
        QString number;
        for (int i=0; i<filenames.length(); i++) {
            number = QString("%1").arg(i, 6, 'd', 0, QChar('0'));
            ui->animSlider->setValue(i);
            ui->statusbar->showMessage("Saving file"+dir+"/muviewSequence"+number+".jpg");
            update();
            viewport->renderFrame(dir+"/muviewSequence"+number+".jpg");
        }

        disconnect(viewport, SIGNAL(doneRenderingFrame(QString)), this, SLOT(saveImageFile(QString)));
    }
}
grahamrow commented 7 years ago

@syockit was kind enough to fix this, I finally have some time to work on this software so it's made it back into master branch.