diff --git a/projects/ImgCV/ImageProcessing.cpp b/projects/ImgCV/ImageProcessing.cpp index 070496175f..55c96c7357 100644 --- a/projects/ImgCV/ImageProcessing.cpp +++ b/projects/ImgCV/ImageProcessing.cpp @@ -1570,6 +1570,47 @@ ZENDEFNODE(ImageColor, { {"image"}, }, {}, + { "deprecated" }, +}); +struct ImageColor2 : INode { + virtual void apply() override { + auto image = std::make_shared(); + auto color = get_input2("Color"); + auto alpha = get_input2("Alpha"); + auto size = get_input2("Size"); + auto balpha = get_input2("alpha"); + auto vertsize = size[0] * size[1]; + image->verts.resize(vertsize); + image->userData().set2("isImage", 1); + image->userData().set2("w", size[0]); + image->userData().set2("h", size[1]); + if(balpha){ + auto &alphaAttr = image->verts.add_attr("alpha"); + for (int i = 0; i < vertsize ; i++) { + image->verts[i] = {zeno::clamp(color[0], 0.0f, 1.0f), zeno::clamp(color[1], 0.0f, 1.0f), zeno::clamp(color[2], 0.0f, 1.0f)}; + alphaAttr[i] = zeno::clamp(alpha, 0.0f, 1.0f); + } + } + else{ + for (int i = 0; i < vertsize ; i++) { + image->verts[i] = {zeno::clamp(color[0], 0.0f, 1.0f), zeno::clamp(color[1], 0.0f, 1.0f), zeno::clamp(color[2], 0.0f, 1.0f)}; + } + } + set_output("image", image); + } +}; + +ZENDEFNODE(ImageColor2, { + { + {"vec3f", "Color", "1,1,1"}, + {"float", "Alpha", "1"}, + {"vec2i", "Size", "1024,1024"}, + {"bool", "alpha", "1"}, + }, + { + {"image"}, + }, + {}, { "image" }, }); diff --git a/zeno/src/nodes/prim/UVProjectFromPlane.cpp b/zeno/src/nodes/prim/UVProjectFromPlane.cpp index 3ccf4e1a99..37d5424bcd 100644 --- a/zeno/src/nodes/prim/UVProjectFromPlane.cpp +++ b/zeno/src/nodes/prim/UVProjectFromPlane.cpp @@ -585,7 +585,7 @@ struct WriteImageFile : INode { const char* err; path += ".exr"; std::string native_path = std::filesystem::u8path(path).string(); - int ret = SaveEXR(data2.data(),w,h,n,1,native_path.c_str(),&err); + int ret = SaveEXR(data2.data(),w,h,n,0,native_path.c_str(),&err); if (ret != TINYEXR_SUCCESS) { zeno::log_error("Error saving EXR file: {}\n", err);