- {
- auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_Allocate(width, height, 32), FreeImage_Unload);
- image_view<bgra_pixel> destination_view(FreeImage_GetBits(bitmap.get()), width, height);
- image_view<bgra_pixel> complete_frame(const_cast<uint8_t*>(frame.image_data().begin()), format_desc.width, format_desc.height);
- auto thumbnail_view = complete_frame.subview(0, 0, width, height);
-
- std::copy(thumbnail_view.begin(), thumbnail_view.end(), destination_view.begin());
- FreeImage_FlipVertical(bitmap.get());
- FreeImage_SaveU(FIF_PNG, bitmap.get(), output_file.wstring().c_str(), 0);
- }
+{
+ auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_Allocate(width, height, 32), FreeImage_Unload);
+ image_view<bgra_pixel> destination_view(FreeImage_GetBits(bitmap.get()), width, height);
+ image_view<bgra_pixel> complete_frame(const_cast<uint8_t*>(frame.image_data().begin()), format_desc.width, format_desc.height);
+ auto thumbnail_view = complete_frame.subview(0, 0, width, height);
+
+ std::copy(thumbnail_view.begin(), thumbnail_view.end(), destination_view.begin());
+ FreeImage_FlipVertical(bitmap.get());
+#ifdef WIN32
+ FreeImage_SaveU(FIF_PNG, bitmap.get(), output_file.wstring().c_str(), 0);
+#else
+ FreeImage_Save(FIF_PNG, bitmap.get(), u8(output_file.wstring()).c_str(), 0);
+#endif
+}