Page 1 of 2

Create image from geometry and color fails

Posted: 2012-03-19T07:44:31-07:00
by jupiter
Hi,

I simply compiled image magic without all image format libs, on Windows 7 using vs2010, because i don't need them in my project. however, i create an image in my app, fill it with some hard coded pixel data, and write it to a Blob. then i get following exception:
NoDecodeDelegateForThisImageFormat `#000000' @ error/constitute.c/ReadImage/532

then i compiled it again with all libs IM_MOD projects included and get following exception:

NoDecodeDelegateForThisImageFormat `#000000' @ error/blob.c/ImageToBlob/1498

what did i do wrong? do i need something else? i just want to work with plain pixel datas and no special image formats.

any help is appreciated

Jupiter

Re: Create image from geometry and color fails

Posted: 2012-03-19T19:18:58-07:00
by anthony
You had a space between the xc: or canvas: coder and the color the coder is to use. If a space was added, then it sees "#000000" and thinks that may be a filename for a image not an image color!

This should work fine...

Code: Select all

convert -size 100x100 "xc:#000000"  black_image.png
Of course you need some coders or you will not be able to create/read or write any image at all!
That would make IM rather 'deaf' to the outside world!

Re: Create image from geometry and color fails

Posted: 2012-03-19T23:27:03-07:00
by jupiter
im not using the convert.exe, I'm using the c++ api in my own code project. and there i have the raw pixel data already read in another way to memory, and just want to write it pixel wise into an magic::Image. why do i need img_mods then?

Re: Create image from geometry and color fails

Posted: 2012-03-20T00:12:06-07:00
by anthony
Okay. so you will create a blank image and put colors in it.

How about a little code to go with the error then?

Re: Create image from geometry and color fails

Posted: 2012-03-20T01:42:09-07:00
by jupiter

Code: Select all

    Image image;
    unsigned char quantum = 0;
    image = Magick::Image(Magick::Geometry(200, 200), Color(quantum, quantum, quantum));
    image.modifyImage();
    image.type(TrueColorMatteType);
    PixelPacket* magickPixels = image.getPixels(0, 0, 200, 200);
 
    //play a bit around with the pixels here
    image.syncPixels();
    Blob blob;
    image.write(&blob, "RGBA", 32);
in the first problem (without the Im_MODS it crashes on the image = Magick::Image line;

in the second it crashes on the image.write() line

Re: Create image from geometry and color fails

Posted: 2012-03-20T02:32:28-07:00
by jupiter
i have to add: the same code works on mac!

Re: Create image from geometry and color fails

Posted: 2012-03-21T02:02:59-07:00
by jupiter
any ideas? its urgent 8(

Re: Create image from geometry and color fails

Posted: 2012-03-21T05:49:18-07:00
by jupiter

Code: Select all

#include <Magick++.h> 
using namespace std; 
using namespace Magick; 
int main(int argc,char **argv) 
{ 
    Image image( "100x100", "white" ); 
    image.pixelColor( 49, 49, "red" ); 
    image.write( "red_pixel.png" ); 
    return 0; 
}
i also tried above code (from an example) and i still get the exception: NoDecodeDelegateForThisImageFormat `#FFFFFF' @ error/constitute.c/ReadImage/532

Re: Create image from geometry and color fails

Posted: 2012-03-21T06:17:27-07:00
by magick
NoDecodeDelegateForThisImageFormat means ImageMagick is not installed properly or it can't read its configuration files. Check the install paths and make sure your user has permission to read them. Typically its /usr/local/lib/ImageMagick-6.7.6. Try
  • convert -debug configure null: null:

Re: Create image from geometry and color fails

Posted: 2012-03-21T06:21:23-07:00
by jupiter
thanks for reply, I'm on windows using a self compiled image magick without convert. where do i have the config files? and where do i get them from? i just copied the config folder to my application.

Re: Create image from geometry and color fails

Posted: 2012-03-21T06:25:51-07:00
by jupiter
do i need all of the IM_MOD dlls? can i statically link them into the core dlls?

Re: Create image from geometry and color fails

Posted: 2012-03-21T06:28:49-07:00
by magick
You probably need to set the MAGICK_HOME environment variable. See http://www.imagemagick.org/script/advan ... lation.php.

Re: Create image from geometry and color fails

Posted: 2012-03-21T06:38:35-07:00
by jupiter
the mods are currently in the same folder as my imagemagick is located (right next to my app).

what two mods do i have to use, to just create an image play around with its pixels and save it to a blob as RGBA image uncompressed?

do i have to set those enviroment variables also on the customer machine? or just on my developer machine?

Re: Create image from geometry and color fails

Posted: 2012-03-21T06:43:10-07:00
by magick
We have not studied how to strip ImageMagick to just the necessary mods although some users have reported success. The best path is to build the entire distribution and ensure it works, then start strip mods you don't need until your command line breaks.

Re: Create image from geometry and color fails

Posted: 2012-03-21T07:03:22-07:00
by jupiter
well i also made a build with everything, copied every dll then into my application folder, and i still have the exception when i want to write that blob