使用 ImageIO 反转图像中的颜色

问题描述

我目前正在尝试编写一个函数,该函数使用 for (auto it = myMap.begin() ; it != myMap.end();) { if(it->second->needsToBeModified()){ auto out = it++; tmp.push_back(myMap.extract(out)); } else ++it; } 并且没有循环来反转图像,但我遇到了困难。这是我到目前为止的代码

ImageIO

感谢任何帮助!

解决方法

我不确定您面临什么问题,但您快完成了。

只需使用:

imageio.imwrite(*'path_to_file'*,img)

将图像存储在新文件中/替换旧图像并返回。