summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/image.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc
index f005e3f63..95cb93b65 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -1248,7 +1248,9 @@ Image::as_png () const
{
DCPOMATIC_ASSERT (bytes_per_pixel(0) == 4);
DCPOMATIC_ASSERT (planes() == 1);
- DCPOMATIC_ASSERT (pixel_format() == AV_PIX_FMT_BGRA);
+ if (pixel_format() != AV_PIX_FMT_RGBA) {
+ return convert_pixel_format(dcp::YUV_TO_RGB_REC709, AV_PIX_FMT_RGBA, true, false)->as_png();
+ }
/* error handling? */
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, reinterpret_cast<void*>(const_cast<Image*>(this)), png_error_fn, 0);