Unverified Commit 9bccd5aa authored by Edgar Andrés Margffoy Tuay's avatar Edgar Andrés Margffoy Tuay Committed by GitHub
Browse files

Fix ternary operator to decide to store an image in Grayscale or RGB (#3553)


Co-authored-by: default avatarVasilis Vryniotis <datumbox@users.noreply.github.com>
parent 0e802966
...@@ -128,7 +128,7 @@ torch::Tensor encode_png(const torch::Tensor& data, int64_t compression_level) { ...@@ -128,7 +128,7 @@ torch::Tensor encode_png(const torch::Tensor& data, int64_t compression_level) {
png_set_write_fn(png_write, &buf_info, torch_png_write_data, NULL); png_set_write_fn(png_write, &buf_info, torch_png_write_data, NULL);
// Set output image information // Set output image information
auto color_type = PNG_COLOR_TYPE_GRAY ? channels == 1 : PNG_COLOR_TYPE_RGB; auto color_type = channels == 1 ? PNG_COLOR_TYPE_GRAY : PNG_COLOR_TYPE_RGB;
png_set_IHDR( png_set_IHDR(
png_write, png_write,
info_ptr, info_ptr,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment