Page 1 of 1
Convert RGBA to bmp format
Posted: 2017-01-11T03:22:39-07:00
by midas
Can I get help in converting RGBA image to Bitmap?
Re: Convert RGBA to bmp format
Posted: 2017-01-11T03:26:26-07:00
by snibgo
Yes, you can.
Some more detail might help us to help you.
Re: Convert RGBA to bmp format
Posted: 2017-01-11T03:42:23-07:00
by midas
Please find below my code:
#include <Magick++.h>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include "stdafx.h"
using namespace std;
using namespace Magick;
//#pragma warning(disable : 4996)
int main(int argc,char **argv)
{
InitializeMagick(*argv);
return 0;
}
When I build I get below error:
error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl Magick::InitializeMagick(char const *)" (__imp_?InitializeMagick@Magick@@YAXPBD@Z) referenced in function _main
I have done below declarations in Project settings:
C\C++ -> General -> Addtn Include Directories -> ImageMagick-7.0.4-Q16\include
Linker-> General->Addtn Library Directories -> ImageMagick-7.0.4-Q16\lib
Re: Convert RGBA to bmp format
Posted: 2017-01-11T04:26:04-07:00
by snibgo
Okay, so you have a linker error when building your program. What toolchain are you using? I use Gnu C, part of Cygwin, and have no problems. I probably can't help, but perhaps you can say what toolchain you use (and search for that on these forums).
Re: Convert RGBA to bmp format
Posted: 2017-01-11T04:37:12-07:00
by midas
I use below platform toolset:
Visual Studio 2012 (v110)
Also, can you tell me what commands should I use to convert rgba files to bmp?
Re: Convert RGBA to bmp format
Posted: 2017-01-11T05:07:52-07:00
by snibgo
If your RGBA files are literally that, with no header, just pixels, something like this:
Code: Select all
convert -size 123x456 RGBA:in.bin out.bmp
... but with the correct size.
Re: Convert RGBA to bmp format
Posted: 2017-01-11T05:34:32-07:00
by midas
I would be writing it in C++ so let me know what functions should I call?
I searched on the net and found below snippet:
Magick::Blob blob(data, length);
Magick::Image image;
image.size("640x480")
image.magick("RGBA");
image.read(blob);
image.write("file.bmp");
Is this correct?
Re: Convert RGBA to bmp format
Posted: 2017-01-11T05:48:40-07:00
by snibgo
Sorry, I don't use Magick++.