Hi,
Is there sample code somewhere on how to load an image (png) from the resources of an application and convert it to a Magick::Image object? Thanks.
cheers,
roel
Loading images from windows resource section with Magick++
Easier than I thought, here's one for the archives:
Code: Select all
HRSRC resinfo = ::FindResource(_Module.m_hInst, MAKEINTRESOURCE(IDB_CROSS), "png");
DWORD resourcesize = ::SizeofResource(_Module.m_hInst, resinfo);
HGLOBAL pnghandle = ::LoadResource(_Module.m_hInst, resinfo);
void* buf = ::LockResource(pnghandle);
Magick::Blob blob(buf, resourcesize);
Magick::Image image;
image.read(blob);