MCPcopy Create free account
hub / github.com/ImageEngine/cortex / colorSpace

Function colorSpace

src/IECoreImage/OpenImageIOAlgo.cpp:210–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210std::string colorSpace( const std::string &fileFormat, const OIIO::ImageSpec &spec )
211{
212 const char *linear = colorConfig()->getColorSpaceNameByRole( "scene_linear" );
213 if( linear == nullptr )
214 {
215 linear = "Linear";
216 }
217
218 const char *log = colorConfig()->getColorSpaceNameByRole( "compositing_log" );
219 if( log == nullptr )
220 {
221 log = "Cineon";
222 }
223
224 const char *display = colorConfig()->getColorSpaceNameByRole( "color_picking" );
225 if( display == nullptr )
226 {
227 display = "sRGB";
228 }
229
230 if( fileFormat == "bmp" )
231 {
232 return display;
233 }
234 else if( fileFormat == "cineon" )
235 {
236 return log;
237 }
238 else if( fileFormat == "dpx" )
239 {
240 if( spec.format.basetype == TypeDesc::UINT16 )
241 {
242 int bps = spec.get_int_attribute( "oiio:BitsPerSample", 0 );
243 if( bps == 10 || bps == 12 )
244 {
245 return log;
246 }
247 }
248
249 return display;
250 }
251 else if( fileFormat == "jpeg" || fileFormat == "jpeg2000" )
252 {
253 // greyscale jpegs shouldn't get color conversion
254 if( spec.nchannels == 1 && spec.channelnames[0] == "Y" )
255 {
256 return linear;
257 }
258
259 return display;
260 }
261 else if( fileFormat == "png" )
262 {
263 return display;
264 }
265 else if( fileFormat == "tiff" )
266 {
267 if( spec.format.basetype == TypeDesc::UINT8 || spec.format.basetype == TypeDesc::UINT16 )

Callers 3

openMethod · 0.85
doWriteMethod · 0.85
loadMethod · 0.85

Calls 1

colorConfigFunction · 0.85

Tested by

no test coverage detected