Convert RGBA to bmp format

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
midas
Posts: 4
Joined: 2017-01-11T03:18:29-07:00
Authentication code: 1151

Convert RGBA to bmp format

Post by midas » 2017-01-11T03:22:39-07:00

Can I get help in converting RGBA image to Bitmap?

snibgo
Posts: 9406
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert RGBA to bmp format

Post by snibgo » 2017-01-11T03:26:26-07:00

Yes, you can.

Some more detail might help us to help you.
snibgo's IM pages: im.snibgo.com

midas
Posts: 4
Joined: 2017-01-11T03:18:29-07:00
Authentication code: 1151

Re: Convert RGBA to bmp format

Post by midas » 2017-01-11T03:42:23-07:00

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

snibgo
Posts: 9406
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert RGBA to bmp format

Post by snibgo » 2017-01-11T04:26:04-07:00

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).
snibgo's IM pages: im.snibgo.com

midas
Posts: 4
Joined: 2017-01-11T03:18:29-07:00
Authentication code: 1151

Re: Convert RGBA to bmp format

Post by midas » 2017-01-11T04:37:12-07:00

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?

snibgo
Posts: 9406
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert RGBA to bmp format

Post by snibgo » 2017-01-11T05:07:52-07:00

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.
snibgo's IM pages: im.snibgo.com

midas
Posts: 4
Joined: 2017-01-11T03:18:29-07:00
Authentication code: 1151

Re: Convert RGBA to bmp format

Post by midas » 2017-01-11T05:34:32-07:00

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?

snibgo
Posts: 9406
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert RGBA to bmp format

Post by snibgo » 2017-01-11T05:48:40-07:00

Sorry, I don't use Magick++.
snibgo's IM pages: im.snibgo.com

Post Reply