Re: Trouble with using MagickGetSamplingFactors API
"google" <[email protected]> Thu, 4 Jul 2013 09:51:17 +0800
| Newsgroups | gmane.comp.video.graphicsmagick.apis |
|---|---|
| Message-ID | <[email protected]> |
Hi Bob:
I am so Sorry , I didn't describe my ploblem exactly. I just want to strip the input image , and not to change the sampling factor and quality of the input image.
The test pseudo code like that:
***********************************************************************************
int main(int argc, char *argv[])
{
MagickWand *wand = NULL;
char *ptr_quality = NULL;
char *p = NULL;
register long number_factors = 0;
double sampling_factors[3] = {0.0} ;
char *ptr_sampling_factor = NULL;
wand = NewMagickWand();
MagickReadImage(wand, argv[1])
ptr_sampling_factor = MagickGetImageAttribute(wand, "JPEG-Sampling-factors");
for (p = ptr_sampling_factor; p != (char *) NULL; p = strchr(p,',')) {
while (((int) *p != 0) && ((isspace((int) ((unsigned char) *p)) != 0) ||(*p == ','))) {
p++;
}
sampling_factors[number_factors]=atof(p);
number_factors++;
}
MagickSetSamplingFactors(wand, number_factors, sampling_factors);
ptr_quality = MagickGetImageAttribute(wand, "JPEG-Quality");
MagickSetCompressionQuality(wand, strtoul(ptr_quality, NULL, 10));
/* Note : It didn't work by using this method to set quality
MagickSetImageAttribute(wand, (const char *)"JPEG-Quality", (const char *)ptr_quality);
*/
MagickStripImage(wand);
MagickWriteImage(wand, argv[2]);
DestroyMagickWand(wand);
return 0;
}
********************************************************************************************************************
Thank you .
------------------ Original ------------------
From: "Bob Friesenhahn"<[email protected]>;
Date: Wed, Jul 3, 2013 10:17 PM
To: "google"<[email protected]>;
Cc: "graphicsmagick-apis"<[email protected]>;
Subject: Re: [GM-apis] Trouble with using MagickGetSamplingFactors API
On Wed, 3 Jul 2013, google wrote:
> Thank you so much for your reply.
> I had sovled my problem. And I have another problem, when I call MagickStripImage API to
> strip the image, I got a new image which size was larger than input image's , I can't explain
> it. (Note: the two images have the sampling factors and quality. )
> Pseudo code like this:
>
> 1.new MagickWand object;
> 2.read input image
> 3.get the sampling factor and quality
> 4.set the sampling factor and quality
> 5.call MagickStripImage() to strip the image
> 6.write to output image.
We would be able to understand this issue better if you tell us what
the original parameters were (sampling factor and quality) and the new
parameters you used.
Bob
--
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Graphicsmagick-apis mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-apis