MagickCore ingnores quality param

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
evgolsh

MagickCore ingnores quality param

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickCore ingnores quality param

Post by magick »

Try adding this line after out_img is resized:
  • out_img->quality = quality;
Does that fix the problem?
evgolsh

Re: MagickCore ingnores quality param

Post 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.
Post Reply