145{
146 if (!fs::exists(filepath) || !fs::is_regular_file(filepath)) {
147 return false;
148 }
149
150 auto ext = filepath.extension().string();
151 std::ranges::transform(ext, ext.begin(),
152 [](unsigned char c) { return std::tolower(c); });
153
154 static const std::unordered_set<std::string> image_extensions = {
155 ".png", ".jpg", ".jpeg", ".bmp", ".tga",
156 ".psd", ".gif", ".hdr", ".pic", ".pnm"
157 };
158
159 return image_extensions.contains(ext);
160}