Zero size of JPEG image with WriteImage function

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?".
Post Reply
shiengchyi
Posts: 4
Joined: 2011-04-28T00:17:33-07:00
Authentication code: 8675308

Zero size of JPEG image with WriteImage function

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

Re: Zero size of JPEG image with WriteImage function

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
shiengchyi
Posts: 4
Joined: 2011-04-28T00:17:33-07:00
Authentication code: 8675308

Re: Zero size of JPEG image with WriteImage function

Post by shiengchyi »

I got the setting myself.
It should set the attribute "file" of imageInfo, instead of the attribute "filename" of imageInfo.
Post Reply