Create image from geometry and color fails

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Create image from geometry and color fails

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Create image from geometry and color fails

Post 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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Create image from geometry and color fails

Post 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?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post 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
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post by jupiter »

i have to add: the same code works on mac!
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post by jupiter »

any ideas? its urgent 8(
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Create image from geometry and color fails

Post 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:
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post 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.
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post by jupiter »

do i need all of the IM_MOD dlls? can i statically link them into the core dlls?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Create image from geometry and color fails

Post by magick »

You probably need to set the MAGICK_HOME environment variable. See http://www.imagemagick.org/script/advan ... lation.php.
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Create image from geometry and color fails

Post 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.
jupiter
Posts: 28
Joined: 2011-11-17T07:45:55-07:00
Authentication code: 8675308

Re: Create image from geometry and color fails

Post 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
Post Reply