Given the following
- Bitmap raw image data in char array
- Image width and height
- Path
wzAppDataDirectoryin std::wstring generated using the following code
// Get a good path.
wchar_t wzAppDataDirectory[MAX_PATH];
wcscpy_s( wzAppDataDirectory, MAX_PATH, Windows::Storage::ApplicationData::Current->LocalFolder->Path->Data() );
wcscat_s( wzAppDataDirectory, MAX_PATH, (std::wstring(L"\\") + fileName).c_str() );
How can we save the image as JPG? (Include encoding as well as the char array is raw bitmap form)
Code example is very much appreciated.
This is an example code which I obtained from my friend.
It uses OpenCV’s Mat data structure. Note that, you need to ensure the unsigned char data array within
cv::Matis in continuous form.cv::cvtColorwill do the trick (Or,cv::Mat.clone).Take note, do not use OpenCV’s
imwrite. As at current time of writing,imwritedoesn’t pass Windows Store Certification Test. It is using several APIs, which is prohibited in WinRT.