I use the ConstituteImage function to generate a GRAY Level image, then use the ImageToFile function to save the image file in JPEG format.
The version of ImageMagick is 6.5.4-8 2009-10-24 Q16 OpenMP.
Here is the code.
ExceptionInfo *exception;
exception = AcquireExceptionInfo();
Image *img;
img = ConstituteImage(height, width, "I", CharPixel, imgBlobBuffer, exception); //imgBlobBuffer is an Unsigned Char array, and one byte per pixel
ImageToFile(img, Path, exception); //Path is file path like this "./test.jpeg"
I get a run time error at ImageToFile function:
magick/blob.c:1523: ImageToFile: Assertion `image->blob->type != UndefinedStream' failed. Aborted
Does anybody could tell me what wrong is it?
The run time error of ImageToFile in MagickCore
-
- Posts: 4
- Joined: 2011-04-28T00:17:33-07:00
- Authentication code: 8675308
Re: The run time error of ImageToFile in MagickCore
Use WriteImage() rather than ImageToFile(). ImageToFile() reads bytes from disk and writes them to the specified file whereas WriteImage() writes the image pixels to disk in the format you specify.
-
- Posts: 4
- Joined: 2011-04-28T00:17:33-07:00
- Authentication code: 8675308
Re: The run time error of ImageToFile in MagickCore
Yeah~ It is wording now!! Thank you very much~!!