ImageMagick and usage in c++ application Question

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
Vlnka
Posts: 2
Joined: 2017-04-15T02:44:00-07:00
Authentication code: 1151

ImageMagick and usage in c++ application Question

Post by Vlnka »

Hello

I found ImageMagick when I searched for some graphic library for c++. I was read IM page but I still can't get if IM is right for me. There are my questions:

1. Can I use IM for display and create graphics inside my c++ application? I want it for UI and maybe for all other graphics, like create, paint and etc..
I am learning SDL2 and want use IM for graphics.

2. Can IM manipulate svg images? Like change color for shapes or change effect, like blur or shadow.

3. The license looks like I can use it for commercial product. But it is not clear to me, if I decide use IM for my commercial product, can I link IM as statick library and I don't need show my code, if someone ask for it?

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

Re: ImageMagick and usage in c++ application Question

Post by snibgo »

1. IM contains code to create and manipulate raster images. It contains virtually no code to display those images on screens, or other user-interface facilities.

2. IM can convert SVG to raster, then manipulate the raster image to blur or shadow etc. But it doesn't modify the SVG.

3. As far as I understand the IM licence http://www.imagemagick.org/script/license.php, nothing in there requires you to show your source code to anyone, even if that source code is derived from IM. (However, if you contribute your source code to IM, it will be publically available. I don't suppose this applies to you.)
snibgo's IM pages: im.snibgo.com
Vlnka
Posts: 2
Joined: 2017-04-15T02:44:00-07:00
Authentication code: 1151

Re: ImageMagick and usage in c++ application Question

Post by Vlnka »

Sorry for late answer.

1. Thanks, I am aware of this, but I want instead write image as file, either write image in to memory or send pixels in to SDL_Surface and then display it on my application. It is possible with this way?
I tried this, but without success. I am still learning SDL and I was able to display something, but it is mess of pixels and program crashing.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick and usage in c++ application Question

Post by snibgo »

IM can write an image as a file, as PNG or TIFF or JPEG or many other formats.

I know nothing about SDL. From https://wiki.libsdl.org/SDL_Surface , SDL_Surface is a simple format. It seems easy to loop through y and x: read an IM image pixel, use data from the https://wiki.libsdl.org/SDL_PixelFormat structure to do any required type conversion, and set the array element of the "pixels" structure.

If the IM and SDL pixel data types correspond (eg Uint16, RGB channels, in the same order), you might be able to memcpy() from IM to SDL.

Even better, perhaps you can simply set SDL's void* pointer to point at IM's data.
snibgo's IM pages: im.snibgo.com
Post Reply