Skip to content

Commit f0ff109

Browse files
vincentqbfacebook-github-bot
authored andcommitted
[fbsync] Fix ternary operator to decide to store an image in Grayscale or RGB (#3553)
Summary: Co-authored-by: Vasilis Vryniotis <[email protected]> Reviewed By: fmassa Differential Revision: D27127992 fbshipit-source-id: 76ef726f854788ce71e785a838637e521d1f422c
1 parent 68c1c22 commit f0ff109

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchvision/csrc/io/image/cpu/encode_png.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ torch::Tensor encode_png(const torch::Tensor& data, int64_t compression_level) {
128128
png_set_write_fn(png_write, &buf_info, torch_png_write_data, NULL);
129129

130130
// Set output image information
131-
auto color_type = PNG_COLOR_TYPE_GRAY ? channels == 1 : PNG_COLOR_TYPE_RGB;
131+
auto color_type = channels == 1 ? PNG_COLOR_TYPE_GRAY : PNG_COLOR_TYPE_RGB;
132132
png_set_IHDR(
133133
png_write,
134134
info_ptr,

0 commit comments

Comments
 (0)