Page 1 of 1

Problems using magick++

Posted: 2013-12-30T10:14:02-07:00
by REPTILE
Hello,

i am try to use magick++ for my vc++.net projects.... I use Visual Studio 2013

i have successfully compiled the magick++ libs and dlls.... now i have write a small progamm to test the function of the magick++

Code: Select all

#include "stdafx.h"
#include <cstdio>
#include <iostream>
#include <string.h>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int _tmain(int argc, _TCHAR* argv[])
{
	InitializeMagick("C:\build\testc\Debug");
  
	Magick::Image img;
	img.density(Magick::Geometry(36, 36));
	img.read("test.jpg");
	img.write("c:\test2.tif");
 
	return 0;
}
the code builds without errors... but when i start the programm,i get an access violation
Ausnahmefehler bei 0x5F9B81A0 (CORE_RL_Magick++_.dll) in testc.exe: 0xC0000005: Zugriffsverletzung beim Schreiben an Position 0xCD3CDE58
Image

some one know that is wrong?
thanks

Re: Problems using magick++

Posted: 2013-12-31T06:14:53-07:00
by dlemstra
The access violation will be fixed but that won't resolve your issue. This looks like a text encoding problem. Are you using the same 'Character Set' in both builds?

Re: Problems using magick++

Posted: 2013-12-31T09:08:11-07:00
by REPTILE
Yes it seems to be, strange content of the "fileName_" char, but i tested some settings any change....
I have set the "Charset" (Config/common settings) to Unicode-Charset on both projects (magick++ and my project), or exist somethings else to change the charset?

Re: Problems using magick++

Posted: 2014-01-01T10:45:10-07:00
by dlemstra
Can you switch it back to 'Multi-Byte Character Set' to see if that will resolve your problem?

Re: Problems using magick++

Posted: 2014-01-02T10:12:07-07:00
by REPTILE
hi,

now i have start from scratch, delete all projekt files, unzip the "imagemagick-windows.zip", run the configure program and build magick++ without any config change.... this was done without errors...
So, now build my testprogramm and now i have a different error at runtime....

Code: Select all

Unhandled exception at 0x7539C41F in testc.exe: Microsoft C++ exception: Magick::ErrorBlob at memory location 0x0032F5C4.

Re: Problems using magick++

Posted: 2014-01-02T11:35:18-07:00
by dlemstra
Did you escape your slashes this time?

Code: Select all

"C:\\build\\testc\\Debug"

Re: Problems using magick++

Posted: 2014-01-03T09:05:45-07:00
by REPTILE
Yes i did, but without success... at the moment i give up :), now i use magick.net in my vb.net main program. This works fine :)

Do you know how i convert the color depth of a picture.... ?

.SetAttribute("depth", 12) only sets the attribut for this but this result in false colors... i want to convert e.g. a 8bit (per color) picture to 12bit (i need this for next process)

Re: Problems using magick++

Posted: 2014-01-03T09:19:46-07:00
by dlemstra
You can use the Depth property of MagickImage to change the color depth.

Re: Problems using magick++

Posted: 2014-01-03T10:03:02-07:00
by REPTILE
dlemstra wrote:You can use the Depth property of MagickImage to change the color depth.
mhh, this result in the same color depth, when i load a 8 bit picture, the output picture is also 8bit

Code: Select all

Using image As New MagickImage(input)
            image.BitDepth(12)
            image.Write(output)
        End Using

Re: Problems using magick++

Posted: 2014-01-03T10:36:33-07:00
by dlemstra
What is your output format? Maybe that format does not support 12 bit colors?

Re: Problems using magick++

Posted: 2014-01-03T11:07:23-07:00
by REPTILE
TIF, and TIF supports 12bit

with the command line tool "convert" this works with "-depth 12"

Re: Problems using magick++

Posted: 2014-01-03T12:06:40-07:00
by dlemstra
BitDepth expects a Channels enumeration and not your channel depth. For now you will have to do this: Image.BitDepth(Channels.Composite, 12) but I will add a method that excepts an integer. If you need more help you should ask your questions here: https://magick.codeplex.com/discussions.

Re: Problems using magick++

Posted: 2014-01-03T13:39:31-07:00
by REPTILE
thanks for your help, i have post a topic on the provided link.... something with dpx images is not working.....