c++


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.

Related Links

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++

Categories

HOME
dll
asp-classic
mongoose
external
pygtk
navbar
salt-stack
watchkit
conv-neural-network
border
eventtrigger
react-boilerplate
serenity-bdd
qtspim
workspace
django-channels
size-classes
footable
wijmo5
master-detail
side-effects
omnipay
jquery-chosen
grunt-connect-proxy
required
quickbooks-online
tablet
polymer-serve
swiftmailer
thinktecture-ident-model
powerdns
sphero-api
templating
configuration-files
gold-parser
lighttable
pbs
xquery-sql
run-configuration
masm
object-oriented-analysis
graylog
orders
fuzzy
sift
angularjs-service
c#-to-vb.net
type-systems
hashset
syncsort-dmx-h
pdfobject
twebbrowser
ilmerge
nokia
xlconnect
numerical-analysis
dotpeek
typing
listboxitem
scrapyd
execution-time
adobe-flash-cs3
stompjs
xcode-bots
meter
django-pipeline
authentication-flows
streaminsight
savefiledialog
like
review
httplib
wtl
fast-esp
stop-words
textile
nools
sine-wave
galera
mathgl
resourcedictionary
struts2-tiles-plugin
ereg
xadisk
wexitstatus
capability
robohelp
nested-queries
texinfo
wymeditor
snk
xmlnodelist
tomahawk
html-rendering
abbreviation
flashlite

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile