Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gegl:convert_space & icc profile
#1
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;
}
Reply


Messages In This Thread
gegl:convert_space & icc profile - by bear.hsiung - 04-18-2025, 12:59 AM
RE: gegl:convert_space & icc profile - by Ofnuts - 04-18-2025, 07:57 AM

Forum Jump: