Problems using magick++

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
REPTILE
Posts: 7
Joined: 2013-12-30T10:03:20-07:00
Authentication code: 6789

Problems using magick++

Post by REPTILE » 2013-12-30T10:14:02-07:00

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

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problems using magick++

Post by dlemstra » 2013-12-31T06:14:53-07:00

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?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

REPTILE
Posts: 7
Joined: 2013-12-30T10:03:20-07:00
Authentication code: 6789

Re: Problems using magick++

Post by REPTILE » 2013-12-31T09:08:11-07:00

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?

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problems using magick++

Post by dlemstra » 2014-01-01T10:45:10-07:00

Can you switch it back to 'Multi-Byte Character Set' to see if that will resolve your problem?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

REPTILE
Posts: 7
Joined: 2013-12-30T10:03:20-07:00
Authentication code: 6789

Re: Problems using magick++

Post by REPTILE » 2014-01-02T10:12:07-07:00

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.

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problems using magick++

Post by dlemstra » 2014-01-02T11:35:18-07:00

Did you escape your slashes this time?

Code: Select all

"C:\\build\\testc\\Debug"
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

REPTILE
Posts: 7
Joined: 2013-12-30T10:03:20-07:00
Authentication code: 6789

Re: Problems using magick++

Post by REPTILE » 2014-01-03T09:05:45-07:00

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)

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problems using magick++

Post by dlemstra » 2014-01-03T09:19:46-07:00

You can use the Depth property of MagickImage to change the color depth.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

REPTILE
Posts: 7
Joined: 2013-12-30T10:03:20-07:00
Authentication code: 6789

Re: Problems using magick++

Post by REPTILE » 2014-01-03T10:03:02-07:00

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

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problems using magick++

Post by dlemstra » 2014-01-03T10:36:33-07:00

What is your output format? Maybe that format does not support 12 bit colors?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

REPTILE
Posts: 7
Joined: 2013-12-30T10:03:20-07:00
Authentication code: 6789

Re: Problems using magick++

Post by REPTILE » 2014-01-03T11:07:23-07:00

TIF, and TIF supports 12bit

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

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problems using magick++

Post by dlemstra » 2014-01-03T12:06:40-07:00

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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

REPTILE
Posts: 7
Joined: 2013-12-30T10:03:20-07:00
Authentication code: 6789

Re: Problems using magick++

Post by REPTILE » 2014-01-03T13:39:31-07:00

thanks for your help, i have post a topic on the provided link.... something with dpx images is not working.....

Post Reply