(self, webpage, visuals, image_path)
| 137 | |
| 138 | # save image to the disk |
| 139 | def save_images(self, webpage, visuals, image_path): |
| 140 | visuals = self.convert_visuals_to_numpy(visuals) |
| 141 | |
| 142 | image_dir = webpage.get_image_dir() |
| 143 | short_path = ntpath.basename(image_path[0]) |
| 144 | name = os.path.splitext(short_path)[0] |
| 145 | |
| 146 | webpage.add_header(name) |
| 147 | ims = [] |
| 148 | txts = [] |
| 149 | links = [] |
| 150 | |
| 151 | for label, image_numpy in visuals.items(): |
| 152 | image_name = os.path.join(label, '%s.png' % (name)) |
| 153 | save_path = os.path.join(image_dir, image_name) |
| 154 | util.save_image(image_numpy, save_path, create_dir=True) |
| 155 | |
| 156 | ims.append(image_name) |
| 157 | txts.append(label) |
| 158 | links.append(image_name) |
| 159 | webpage.add_images(ims, txts, links, width=self.win_size) |
no test coverage detected