@@ -289,6 +289,7 @@ namespace sharp {
289289 case ImageType::JXL: id = " jxl" ; break ;
290290 case ImageType::RAD: id = " rad" ; break ;
291291 case ImageType::DCRAW: id = " dcraw" ; break ;
292+ case ImageType::UHDR: id = " uhdr" ; break ;
292293 case ImageType::VIPS: id = " vips" ; break ;
293294 case ImageType::RAW: id = " raw" ; break ;
294295 case ImageType::UNKNOWN: id = " unknown" ; break ;
@@ -339,6 +340,9 @@ namespace sharp {
339340 { " VipsForeignLoadRadBuffer" , ImageType::RAD },
340341 { " VipsForeignLoadDcRawFile" , ImageType::DCRAW },
341342 { " VipsForeignLoadDcRawBuffer" , ImageType::DCRAW },
343+ { " VipsForeignLoadUhdr" , ImageType::UHDR },
344+ { " VipsForeignLoadUhdrFile" , ImageType::UHDR },
345+ { " VipsForeignLoadUhdrBuffer" , ImageType::UHDR },
342346 { " VipsForeignLoadVips" , ImageType::VIPS },
343347 { " VipsForeignLoadVipsFile" , ImageType::VIPS },
344348 { " VipsForeignLoadRaw" , ImageType::RAW }
@@ -356,6 +360,9 @@ namespace sharp {
356360 imageType = it->second ;
357361 }
358362 }
363+ if (imageType == ImageType::UHDR) {
364+ imageType = ImageType::JPEG;
365+ }
359366 return imageType;
360367 }
361368
@@ -375,6 +382,9 @@ namespace sharp {
375382 imageType = ImageType::MISSING;
376383 }
377384 }
385+ if (imageType == ImageType::UHDR) {
386+ imageType = ImageType::JPEG;
387+ }
378388 return imageType;
379389 }
380390
@@ -1127,4 +1137,20 @@ namespace sharp {
11271137 }
11281138 return image;
11291139 }
1140+
1141+ /*
1142+ Does this image have a gain map?
1143+ */
1144+ bool HasGainMap (VImage image) {
1145+ return image.get_typeof (" gainmap-data" ) == VIPS_TYPE_BLOB;
1146+ }
1147+
1148+ /*
1149+ Removes gain map, if any.
1150+ */
1151+ VImage RemoveGainMap (VImage image) {
1152+ VImage copy = image.copy ();
1153+ copy.remove (" gainmap-data" );
1154+ return copy;
1155+ }
11301156} // namespace sharp
0 commit comments