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

Zero size of JPEG image with WriteImage function

Postby shiengchyi » 2011-04-28T19:31:05-07:00

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: 8736
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia
Contact:

Re: Zero size of JPEG image with WriteImage function

Postby anthony » 2011-04-30T03:17:12-07:00

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
http://www.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

Postby shiengchyi » 2011-05-02T00:06:26-07:00

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


Return to “Users”

Who is online

Users browsing this forum: Bing [Bot] and 5 guests