Commit 4065f6c8 for libheif
commit 4065f6c836f1855752042f4157c0b54246d46611
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Wed May 13 21:40:39 2026 +0200
consistently use heif_colorspace_custom instead of heif_colorspace_nonvisual
diff --git a/examples/heif_info.cc b/examples/heif_info.cc
index d893f562..c3a4fb79 100644
--- a/examples/heif_info.cc
+++ b/examples/heif_info.cc
@@ -309,8 +309,8 @@ int main(int argc, char** argv)
case heif_colorspace_monochrome:
printf("monochrome");
break;
- case heif_colorspace_nonvisual:
- printf("non-visual");
+ case heif_colorspace_custom:
+ printf("custom");
break;
default:
printf("unknown");
diff --git a/go/heif/heif.go b/go/heif/heif.go
index c4c85bf4..4a50bbe1 100644
--- a/go/heif/heif.go
+++ b/go/heif/heif.go
@@ -69,7 +69,6 @@ type Chroma C.enum_heif_chroma
const (
ChromaUndefined = C.heif_chroma_undefined
- ChromaMonochrome = C.heif_chroma_monochrome
Chroma420 = C.heif_chroma_420
Chroma422 = C.heif_chroma_422
Chroma444 = C.heif_chroma_444
@@ -79,7 +78,9 @@ const (
ChromaInterleavedRRGGBBAA_LE = C.heif_chroma_interleaved_RRGGBBAA_LE
ChromaInterleavedRRGGBB_BE = C.heif_chroma_interleaved_RRGGBB_BE
ChromaInterleavedRRGGBB_LE = C.heif_chroma_interleaved_RRGGBB_LE
+ ChromaPlanar = C.heif_chroma_planar
+ ChromaMonochrome = C.heif_chroma_monochrome
ChromaInterleaved24Bit = C.heif_chroma_interleaved_24bit
ChromaInterleaved32Bit = C.heif_chroma_interleaved_32bit
)
diff --git a/heifio/decoder_raw.cc b/heifio/decoder_raw.cc
index a17ed8e0..8c4dcea4 100644
--- a/heifio/decoder_raw.cc
+++ b/heifio/decoder_raw.cc
@@ -176,10 +176,10 @@ heif_error loadRAW(const char* filename, const RawImageParameters& params, Input
}
// Create image with nonvisual colorspace for typed component API
- struct heif_image* image = nullptr;
+ heif_image* image = nullptr;
heif_error err = heif_image_create(width, height,
- heif_colorspace_nonvisual,
- heif_chroma_undefined,
+ heif_colorspace_custom,
+ heif_chroma_planar,
&image);
if (err.code != heif_error_Ok) {
return err;
diff --git a/heifio/decoder_tiff.cc b/heifio/decoder_tiff.cc
index 980371e5..d19bc457 100644
--- a/heifio/decoder_tiff.cc
+++ b/heifio/decoder_tiff.cc
@@ -686,7 +686,7 @@ static heif_error readMonoFloat(TIFF* tif, heif_image** image)
return err;
}
- err = heif_image_create((int)width, (int)height, heif_colorspace_nonvisual, heif_chroma_undefined, image);
+ err = heif_image_create((int)width, (int)height, heif_colorspace_custom, heif_chroma_planar, image);
if (err.code != heif_error_Ok) {
return err;
}
@@ -733,7 +733,7 @@ static heif_error readMonoSignedInt(TIFF* tif, uint16_t bps, heif_image** image)
return err;
}
- err = heif_image_create((int)width, (int)height, heif_colorspace_nonvisual, heif_chroma_undefined, image);
+ err = heif_image_create((int)width, (int)height, heif_colorspace_custom, heif_chroma_planar, image);
if (err.code != heif_error_Ok) {
return err;
}
@@ -1026,7 +1026,7 @@ static heif_error readTiledContiguous(TIFF* tif, uint32_t width, uint32_t height
if (isFloat) {
#if WITH_UNCOMPRESSED_CODEC
- heif_error err = heif_image_create((int)width, (int)height, heif_colorspace_nonvisual, heif_chroma_undefined, out_image);
+ heif_error err = heif_image_create((int)width, (int)height, heif_colorspace_custom, heif_chroma_planar, out_image);
if (err.code != heif_error_Ok) return err;
uint32_t component_idx;
@@ -1086,7 +1086,7 @@ static heif_error readTiledContiguous(TIFF* tif, uint32_t width, uint32_t height
if (isSignedInt) {
#if WITH_UNCOMPRESSED_CODEC
- heif_error err = heif_image_create((int)width, (int)height, heif_colorspace_nonvisual, heif_chroma_undefined, out_image);
+ heif_error err = heif_image_create((int)width, (int)height, heif_colorspace_custom, heif_chroma_planar, out_image);
if (err.code != heif_error_Ok) return err;
uint32_t component_idx;
@@ -1632,7 +1632,7 @@ heif_error TiledTiffReader::readTile(uint32_t tx, uint32_t ty, int output_bit_de
if (m_sample_format == SAMPLEFORMAT_IEEEFP) {
#if WITH_UNCOMPRESSED_CODEC
- heif_error err = heif_image_create((int)actual_w, (int)actual_h, heif_colorspace_nonvisual, heif_chroma_undefined, out_image);
+ heif_error err = heif_image_create((int)actual_w, (int)actual_h, heif_colorspace_custom, heif_chroma_planar, out_image);
if (err.code != heif_error_Ok) return err;
uint32_t component_idx;
@@ -1679,7 +1679,7 @@ heif_error TiledTiffReader::readTile(uint32_t tx, uint32_t ty, int output_bit_de
if (m_sample_format == SAMPLEFORMAT_INT) {
#if WITH_UNCOMPRESSED_CODEC
- heif_error err = heif_image_create((int)actual_w, (int)actual_h, heif_colorspace_nonvisual, heif_chroma_undefined, out_image);
+ heif_error err = heif_image_create((int)actual_w, (int)actual_h, heif_colorspace_custom, heif_chroma_planar, out_image);
if (err.code != heif_error_Ok) return err;
uint32_t component_idx;
diff --git a/libheif/api/libheif/heif_emscripten.h b/libheif/api/libheif/heif_emscripten.h
index 256bab7c..7e9a5bbb 100644
--- a/libheif/api/libheif/heif_emscripten.h
+++ b/libheif/api/libheif/heif_emscripten.h
@@ -553,6 +553,7 @@ EMSCRIPTEN_BINDINGS(libheif) {
.value("heif_chroma_interleaved_RRGGBBAA_BE", heif_chroma_interleaved_RRGGBBAA_BE)
.value("heif_chroma_interleaved_RRGGBB_LE", heif_chroma_interleaved_RRGGBB_LE)
.value("heif_chroma_interleaved_RRGGBBAA_LE", heif_chroma_interleaved_RRGGBBAA_LE)
+ .value("heif_chroma_planar", heif_chroma_planar)
// Aliases
.value("heif_chroma_interleaved_24bit", heif_chroma_interleaved_24bit)
.value("heif_chroma_interleaved_32bit", heif_chroma_interleaved_32bit);
@@ -569,7 +570,7 @@ EMSCRIPTEN_BINDINGS(libheif) {
.value("heif_colorspace_RGB", heif_colorspace_RGB)
.value("heif_colorspace_monochrome", heif_colorspace_monochrome)
.value("heif_colorspace_filter_array", heif_colorspace_filter_array)
- .value("heif_colorspace_nonvisual", heif_colorspace_nonvisual);
+ .value("heif_colorspace_custom", heif_colorspace_custom);
emscripten::enum_<heif_channel>("heif_channel")
.value("heif_channel_Y", heif_channel_Y)
.value("heif_channel_Cr", heif_channel_Cr)
diff --git a/libheif/codecs/uncompressed/unc_encoder_component_interleave.cc b/libheif/codecs/uncompressed/unc_encoder_component_interleave.cc
index 2ea7801b..d055ca15 100644
--- a/libheif/codecs/uncompressed/unc_encoder_component_interleave.cc
+++ b/libheif/codecs/uncompressed/unc_encoder_component_interleave.cc
@@ -91,7 +91,7 @@ unc_encoder_component_interleave::unc_encoder_component_interleave(const std::sh
const heif_encoding_options& options)
: unc_encoder(image)
{
- bool is_nonvisual = (image->get_colorspace() == heif_colorspace_nonvisual);
+ bool is_custom = (image->get_colorspace() == heif_colorspace_custom);
//uint32_t num_components = image->get_number_of_used_components();
auto componentIds = image->get_used_planar_component_ids();
@@ -100,7 +100,7 @@ unc_encoder_component_interleave::unc_encoder_component_interleave(const std::sh
heif_unci_component_type comp_type;
heif_channel ch = heif_channel_Y; // default for nonvisual
- if (is_nonvisual) {
+ if (is_custom) {
comp_type = static_cast<heif_unci_component_type>(image->get_component_type(id));
}
else {
diff --git a/libheif/image-items/image_item.cc b/libheif/image-items/image_item.cc
index c34c3884..de56d7f1 100644
--- a/libheif/image-items/image_item.cc
+++ b/libheif/image-items/image_item.cc
@@ -698,7 +698,7 @@ ImageItem::add_color_profile(const std::shared_ptr<HeifPixelImage>& image,
if (input_class == heif_image_input_class_normal || input_class == heif_image_input_class_thumbnail) {
// No color profile for non-visual images (e.g. elevation data)
- if (image->get_colorspace() == heif_colorspace_nonvisual) {
+ if (image->get_colorspace() == heif_colorspace_custom) {
return colr_boxes;
}
diff --git a/libheif/image/pixelimage.cc b/libheif/image/pixelimage.cc
index 72dd8ed0..333c2952 100644
--- a/libheif/image/pixelimage.cc
+++ b/libheif/image/pixelimage.cc
@@ -857,7 +857,7 @@ uint16_t HeifPixelImage::get_visual_image_bits_per_pixel() const
return get_bits_per_pixel(heif_channel_interleaved);
}
break;
- case heif_colorspace_nonvisual:
+ case heif_colorspace_custom:
return 0;
break;
case heif_colorspace_filter_array:
@@ -871,7 +871,7 @@ uint16_t HeifPixelImage::get_visual_image_bits_per_pixel() const
}
-heif_component_datatype HeifPixelImage::get_datatype(enum heif_channel channel) const
+heif_component_datatype HeifPixelImage::get_datatype(heif_channel channel) const
{
auto* comp = find_component_for_channel(channel);
if (!comp) {
diff --git a/tests/pixel_data_types.cc b/tests/pixel_data_types.cc
index 00138735..5b6f78a6 100644
--- a/tests/pixel_data_types.cc
+++ b/tests/pixel_data_types.cc
@@ -32,7 +32,7 @@ TEST_CASE( "uint32_t" )
HeifPixelImage image;
auto* limits = heif_get_global_security_limits();
- image.create(3,2, heif_colorspace_nonvisual, heif_chroma_planar);
+ image.create(3,2, heif_colorspace_custom, heif_chroma_planar);
image.add_channel(heif_channel_Y, 3,2, heif_component_datatype_unsigned_integer, 32, limits);
size_t stride;
@@ -131,7 +131,7 @@ TEST_CASE( "complex64_t" )
HeifPixelImage image;
auto* limits = heif_get_global_security_limits();
- image.create(3,2, heif_colorspace_nonvisual, heif_chroma_planar);
+ image.create(3,2, heif_colorspace_custom, heif_chroma_planar);
image.add_channel(heif_channel_Y, 3,2, heif_component_datatype_complex_number, 128, limits);
size_t stride;
@@ -161,7 +161,7 @@ TEST_CASE( "complex64_t" )
TEST_CASE( "image datatype through public API" )
{
heif_image* image;
- heif_error error = heif_image_create(3,2,heif_colorspace_nonvisual, heif_chroma_planar, &image);
+ heif_error error = heif_image_create(3,2,heif_colorspace_custom, heif_chroma_planar, &image);
REQUIRE(!error.code);
uint32_t comp_idx;
diff --git a/tests/uncompressed_encode_multicomponent.cc b/tests/uncompressed_encode_multicomponent.cc
index 0e413ba0..3d39926a 100644
--- a/tests/uncompressed_encode_multicomponent.cc
+++ b/tests/uncompressed_encode_multicomponent.cc
@@ -245,7 +245,7 @@ static heif_image* create_and_fill_image(heif_component_datatype datatype, int b
heif_image* image = nullptr;
heif_error err;
- err = heif_image_create(kWidth, kHeight, heif_colorspace_nonvisual,
+ err = heif_image_create(kWidth, kHeight, heif_colorspace_custom,
heif_chroma_planar, &image);
REQUIRE(err.code == heif_error_Ok);
REQUIRE(image != nullptr);
@@ -452,7 +452,7 @@ TEST_CASE("Mixed bpp: 16-bit and 14-bit components")
// Create image
heif_image* image = nullptr;
- heif_error err = heif_image_create(kW, kH, heif_colorspace_nonvisual,
+ heif_error err = heif_image_create(kW, kH, heif_colorspace_custom,
heif_chroma_planar, &image);
REQUIRE(err.code == heif_error_Ok);