| 302 | } |
| 303 | |
| 304 | std::optional<std::string> Bitmap::ExifCameraModel() const { |
| 305 | // Read camera make and model |
| 306 | const std::optional<std::string> make_str = GetMetaData("Make"); |
| 307 | if (!make_str.has_value()) { |
| 308 | return std::nullopt; |
| 309 | } |
| 310 | const std::optional<std::string> model_str = GetMetaData("Model"); |
| 311 | if (!model_str.has_value()) { |
| 312 | return std::nullopt; |
| 313 | } |
| 314 | float focal_length = 0; |
| 315 | if (!GetMetaData("Exif:FocalLengthIn35mmFilm", "float", &focal_length) && |
| 316 | !GetMetaData("Exif:FocalLength", "float", &focal_length)) { |
| 317 | return std::nullopt; |
| 318 | } |
| 319 | std::string camera_model = StringPrintf("%s-%s-%.6f-%dx%d", |
| 320 | make_str->c_str(), |
| 321 | model_str->c_str(), |
| 322 | static_cast<double>(focal_length), |
| 323 | width_, |
| 324 | height_); |
| 325 | return camera_model; |
| 326 | } |
| 327 | |
| 328 | std::optional<double> Bitmap::ExifFocalLength() const { |
| 329 | const double max_size = std::max(width_, height_); |