hdrfilm/tiledhdrfilm: Save channel name even for 1-channel images if specified

metadata
Wenzel Jakob 2014-08-04 18:20:03 +02:00
parent 338d3cbeb1
commit 5e222601c0
2 changed files with 5 additions and 2 deletions

View File

@ -233,7 +233,8 @@ public:
if (pixelFormats.empty()) if (pixelFormats.empty())
Log(EError, "At least one pixel format must be specified!"); Log(EError, "At least one pixel format must be specified!");
if (pixelFormats.size() != 1 && channelNames.size() != pixelFormats.size()) if ((pixelFormats.size() != 1 && channelNames.size() != pixelFormats.size()) ||
(pixelFormats.size() == 1 && channelNames.size() > 1))
Log(EError, "Number of channel names must match the number of specified pixel formats!"); Log(EError, "Number of channel names must match the number of specified pixel formats!");
if (pixelFormats.size() != 1 && m_fileFormat != Bitmap::EOpenEXR) if (pixelFormats.size() != 1 && m_fileFormat != Bitmap::EOpenEXR)
@ -486,6 +487,7 @@ public:
ref<Bitmap> bitmap; ref<Bitmap> bitmap;
if (m_pixelFormats.size() == 1) { if (m_pixelFormats.size() == 1) {
bitmap = m_storage->getBitmap()->convert(m_pixelFormats[0], m_componentFormat); bitmap = m_storage->getBitmap()->convert(m_pixelFormats[0], m_componentFormat);
bitmap->setChannelNames(m_channelNames);
} else { } else {
bitmap = m_storage->getBitmap()->convertMultiSpectrumAlphaWeight(m_pixelFormats, bitmap = m_storage->getBitmap()->convertMultiSpectrumAlphaWeight(m_pixelFormats,
m_componentFormat, m_channelNames); m_componentFormat, m_channelNames);

View File

@ -111,7 +111,8 @@ public:
if (pixelFormats.empty()) if (pixelFormats.empty())
Log(EError, "At least one pixel format must be specified!"); Log(EError, "At least one pixel format must be specified!");
if (pixelFormats.size() != 1 && channelNames.size() != pixelFormats.size()) if ((pixelFormats.size() != 1 && channelNames.size() != pixelFormats.size()) ||
(pixelFormats.size() == 1 && channelNames.size() > 1))
Log(EError, "Number of channel names must match the number of specified pixel formats!"); Log(EError, "Number of channel names must match the number of specified pixel formats!");
for (size_t i=0; i<pixelFormats.size(); ++i) { for (size_t i=0; i<pixelFormats.size(); ++i) {