Page 1 of 1

Zero size of JPEG image with WriteImage function

Posted: 2011-04-28T19:31:05-07:00
by shiengchyi
I got new problem when I use WriteImage in MagickCore. I got a zero size JPEG image with no error.
The image_info setting is below:
ImageInfo *imgInfo;
imgInfo = AcquireImageInfo();

char * tmpStr;
sprintf(tmpStr,"%dx%d",width,height);
sprintf(imgInfo->filename,"%s",Path); //Path is the file path
imgInfo->size = tmpStr; //Does the size attribute mean total pixels?
imgInfo->compression = JPEGCompression;
imgInfo->colorspace = GRAYColorspace;
imgInfo->type = GrayscaleType;

And here is the output information of WriteImage:
id=ImageMagick version=1.0
class=DirectClass colors=0 matte=False
columns=480 rows=1779 depth=16
colorspace=Gray
compression=JPEG quality=0
units=PixelsPerInch
resolution=72x72

Is there any setting of image_info that I miss? Thanks you~!!

Re: Zero size of JPEG image with WriteImage function

Posted: 2011-04-30T03:17:12-07:00
by anthony
With MagickCore, no errors will ever be produced unless you report the exceptions that happen.

Not certain how that is done however, as I am generally modifying existing code (CLI interface or MagickCore functions) so it is done for me.

Re: Zero size of JPEG image with WriteImage function

Posted: 2011-05-02T00:06:26-07:00
by shiengchyi
I got the setting myself.
It should set the attribute "file" of imageInfo, instead of the attribute "filename" of imageInfo.