Save the frame image to the specified path. The image format is determined from the extension (i.e. image.PNG, image.JPEG)
| 513 | |
| 514 | // Save the frame image to the specified path. The image format is determined from the extension (i.e. image.PNG, image.JPEG) |
| 515 | void Frame::Save(std::string path, float scale, std::string format, int quality) |
| 516 | { |
| 517 | // Get preview image |
| 518 | std::shared_ptr<QImage> previewImage = GetImage(); |
| 519 | |
| 520 | // Update the image to reflect the correct pixel aspect ration (i.e. to fix non-square pixels) |
| 521 | if (pixel_ratio.num != 1 || pixel_ratio.den != 1) |
| 522 | { |
| 523 | // Resize to fix DAR |
| 524 | previewImage = std::make_shared<QImage>(previewImage->scaled( |
| 525 | previewImage->size().width(), previewImage->size().height() * pixel_ratio.Reciprocal().ToDouble(), |
| 526 | Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); |
| 527 | } |
| 528 | |
| 529 | // scale image if needed |
| 530 | if (fabs(scale) > 1.001 || fabs(scale) < 0.999) |
| 531 | { |
| 532 | // Resize image |
| 533 | previewImage = std::make_shared<QImage>(previewImage->scaled( |
| 534 | previewImage->size().width() * scale, previewImage->size().height() * scale, |
| 535 | Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
| 536 | } |
| 537 | |
| 538 | // Save image |
| 539 | previewImage->save(QString::fromStdString(path), format.c_str(), quality); |
| 540 | } |
| 541 | |
| 542 | // Thumbnail the frame image to the specified path. The image format is determined from the extension (i.e. image.PNG, image.JPEG) |
| 543 | void Frame::Thumbnail(std::string path, int new_width, int new_height, std::string mask_path, std::string overlay_path, |
no test coverage detected