Gimp-Forum.net
gegl:convert_space & icc profile - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: gegl:convert_space & icc profile (/Thread-gegl-convert-space-icc-profile)



gegl:convert_space & icc profile - bear.hsiung - 04-18-2025

Hello Sir,
I have some questions about the use of gegl:convert_space.

I used my own icc profile on the image, but the iccprofile did not affect the output image.
The output image is the same as the input. Is there a problem with the process or the use of the gegl library?
Please give me advice. grateful.

Here is my code:

int main(int argc, char* argv[]) {
    if (argc != 4) {
        std::cerr << "使用方式: " << argv[0] << " input.jpg output.jpg icc_profile.icc" << std::endl;
        return 1;
    }

    const char* input_file = argv[1];
    const char* output_file = argv[2];
    const char* icc_profile = argv[3];

    // 初始化 GEGL
    gegl_init(nullptr, nullptr);

    // 加載輸入圖像
    GeglNode* input = gegl_node_new_child(nullptr,
                                          "operation", "gegl:load",
                                          "path", input_file,
                                          nullptr);

    // 應用色彩空間轉換
    GeglNode* convert_space = gegl_node_new_child(nullptr,
                                                  "operation", "gegl:convert-space",
                                                  "path", icc_profile,
                                                  nullptr);

    // 將輸入連接到色彩空間轉換節點
    gegl_node_connect(input, "output", convert_space, "input");  //gegl_node_connect_to(input, "output", convert_space, "input");

    // 保存輸出圖像
    GeglNode* output = gegl_node_new_child(nullptr,
                                           "operation", "geglConfusedave",
                                           "path", output_file,
                                           nullptr);

    // 將色彩空間轉換節點連接到輸出節點
    gegl_node_connect(convert_space, "output", output, "input"); //gegl_node_connect_to(convert_space, "output", output, "input");

    // 處理圖像
    gegl_node_process(output);

    // 釋放資源
    g_object_unref(input);
    g_object_unref(convert_space);
    g_object_unref(output);

    // 結束 GEGL
    gegl_exit();

    std::cout << "色彩空間轉換完成,結果保存至: " << output_file << std::endl;
    return 0;
}


RE: gegl:convert_space & icc profile - Ofnuts - 04-18-2025

Did you try to set the output space to something explicit like SRGB? Otherwise, GEGL questions are best asked there.


RE: gegl:convert_space & icc profile - bear.hsiung - 04-18-2025

(04-18-2025, 07:57 AM)Ofnuts Wrote: Did you try to set the output space to something explicit like SRGB? Otherwise, GEGL questions are best asked there.

Thank you very much.