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?".

Zero size of JPEG image with WriteImage function

Postby shiengchyi » 2011-04-28T19:31:05+00: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~!!
shiengchyi
 
Posts: 4
Joined: 2011-04-28T00:17:33+00:00

Re: Zero size of JPEG image with WriteImage function

Postby anthony » 2011-04-30T03:17:12+00: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/
User avatar
anthony
 
Posts: 8732
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: Zero size of JPEG image with WriteImage function

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

I got the setting myself.
It should set the attribute "file" of imageInfo, instead of the attribute "filename" of imageInfo.
shiengchyi
 
Posts: 4
Joined: 2011-04-28T00:17:33+00:00


Return to Users

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 19 guests