how to init a Magick::Image obj with blob constructed by png data(png was create by cv::imencode)
I tried to create a Magick::Image obj with blob constructed by png data(png was create by cv::imencode). It works fine when I create a Magick::Image obj with blob constructed by jpg data(jpg was create by cv::imencode), but I cannot do it with png data. I want to convert some imgs to gif. The source data are img rawdatas encoded by cv::imencode. I can work out with jpg data, but it's too slow, so I tried to do it with png data, now I got the problem mentioned above. Related Question: ImageMagick convert jpg images to gif slow
Don't bother encoding cv::Mat to any image format blob, only to pass to Magick::Image for decoding. Just pass the pixel data directly to Magick::Image.read. cv::Mat inbound_image = cv::imread("wizard.jpg"); Magick::Image outbound_image; outbound_image.read(inbound_image.cols, // width inbound_image.rows, // height "BGR", // Channel order (should always be "BGR", or "BGRA") Magick::CharPixel, // CV_8U inbound_image.data); // void * outbound_image.write("wizard.gif"); Please note that you'll be responsible for checking cv::Mat.depth() for correct storage size, and cv::Mat.channels() to color channel count.
HTML Code Coverage Report with Visual C++ and Catch
Remove all occurrences of the given string from doubly linked list
Assertion `IsArray()' failed (RapidJSON)
Can't link GTKmm 3 app with minGW64 ithin MSYS2: ustring constructor not found
C++ and C++11 class static member, double should use “constexpr” while int can be “const”, why?
Smallest 'install footprint' for Visual Studio 2017 - C++ core language & standard library
The behaviour of floating point division by zero
Share resource between multiple pthread, POCO thread and boost thread
Should *all* function templates be passed as rvalue?
Clang++ vs g++ difference in overloaded function declaration order [duplicate]
asio::async_write handler gets invoked after 3 seconds
Overriding default destructor for strings in class implementation
C++ error: error: expected primary-expression before '||' token
node-gyp build error “calling a protected constructor of class 'v8::HandleScope'” on mac
Non-exported virtual function results in LNK2001 in derived classes in other projects
Concatenation macro in C++