Commit b047a467 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Restore error dialog when the resulting image size is not even

H264 and H265 codecs cannot handle odd image sizes and just fail.
parent 97402490
......@@ -112,7 +112,7 @@ void AnimaterionRenderer::renderAnimationImpl(KisDocument *doc, KisAnimationRend
/**
* The dialog should endure that the size of the video is even
* The dialog should ensure that the size of the video is even
*/
KIS_SAFE_ASSERT_RECOVER(
!((encoderOptions.width & 0x1 || encoderOptions.height & 0x1)
......@@ -123,6 +123,24 @@ void AnimaterionRenderer::renderAnimationImpl(KisDocument *doc, KisAnimationRend
encoderOptions.height = encoderOptions.height + (encoderOptions.height & 0x1);
}
const QSize scaledSize =
doc->image()->bounds().size().scaled(
encoderOptions.width, encoderOptions.height,
Qt::KeepAspectRatio);
if ((scaledSize.width() & 0x1 || scaledSize.height() & 0x1)
&& (encoderOptions.videoMimeType == "video/mp4" ||
encoderOptions.videoMimeType == "video/x-matroska")) {
QString m = "Mastroska (.mkv)";
if (encoderOptions.videoMimeType == "video/mp4") {
m = "Mpeg4 (.mp4)";
}
qWarning() << m <<"requires width and height to be even, resize and try again!";
doc->setErrorMessage(i18n("%1 requires width and height to be even numbers. Please resize or crop the image before exporting.", m));
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Could not render animation:\n%1", doc->errorMessage()));
return;
}
const bool batchMode = false; // TODO: fetch correctly!
KisAsyncAnimationFramesSaveDialog exporter(doc->image(),
KisTimeRange::fromTime(encoderOptions.firstFrame,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment