Page 1 of 1

MagickCore ingnores quality param

Posted: 2009-01-19T14:53:56-07:00
by evgolsh
Hi,

I'm using MagickCore API in my application. The following code that resizes a jpeg image blob and applies quality was working perfectly well in 6.4.2 version. After I've upgraded API to 6.4.8 the quality param doesn't seem to be respected anymore.

Code: Select all

    Image *image;
    ImageInfo *imageInfo;
    ExceptionInfo *ex = AcquireExceptionInfo();

    imageInfo = CloneImageInfo((ImageInfo *) NULL);
    strcpy(imageInfo->magick, format);
    imageInfo->quality = quality;
    
    image = BlobToImage(imageInfo, blob_ptr, blob_len, ex);

    if (ex->severity != UndefinedException) CatchException(ex);
    if (image == (Image *) NULL) {
        return -1;
    }

   Image *out_img = ResizeImage(image, width, height, filter, blur, ex);

    size_t imageLen;
    unsigned char * outblob = ImageToBlob(imageInfo, out_img, &imageLen, ex);
    if (ex->severity != UndefinedException) CatchException(ex);

    if (NULL == outblob) {
        return 1;
    }

    outblob = (unsigned char *) RelinquishMagickMemory(outblob);
Is behavior I expect has changed and I should request desired jpeg quality other way or this is a bug?

Many thanks,
Eugene.

Re: MagickCore ingnores quality param

Posted: 2009-01-19T17:21:49-07:00
by magick
Try adding this line after out_img is resized:
  • out_img->quality = quality;
Does that fix the problem?

Re: MagickCore ingnores quality param

Posted: 2009-01-20T07:50:08-07:00
by evgolsh
Yes, it seems to work properly this way. Is this the correct way to set image quality in IM? What is the proper way to set out image format?

Thanks a lot,
Eugene.