Writes the image into a file. The file format that is written depends on the extension of the filename. Supported formats are JPEG, PNG, PPM, PGM, PBM. Returns `false` if file could not be written and `true` on success.
(&self, fname: &str)
| 232 | /// Supported formats are JPEG, PNG, PPM, PGM, PBM. Returns `false` if file |
| 233 | /// could not be written and `true` on success. |
| 234 | fn to_file(&self, fname: &str) -> bool { |
| 235 | |
| 236 | let mut s = fname.to_string(); |
| 237 | s.push('\0'); |
| 238 | unsafe { |
| 239 | let r = cvSaveImage( |
| 240 | s.as_ptr() as *const c_char, |
| 241 | self.buffer() as *const CvArr, |
| 242 | 0 as *const c_int |
| 243 | ); |
| 244 | r != 0 |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | /// Copies an area from the given image at location `(x,y )` with width `width` |
| 249 | /// and height `height` into this image at position `(dstx, dsty)`. |