Page 1 of 1

Annotate after Crop - unexpected x,y position

Posted: 2008-04-12T07:45:26-07:00
by roladdon
This is supposed to put text on the picture, in the center just above the bottom of the image:
so I do:
>...
>MagickAnnotateImage(magick_wand_copy,drawing_wand, (iw/2)+3,(ih-FontSize/2)+3,0,txt);
and it works.
but - when I do:
>MagickCropImage(magick_wand_copy, MagickGetImageWidth(magick_wand_copy), 700, 0, 130);
>...
>MagickAnnotateImage(magick_wand_copy,drawing_wand, (iw/2)+3,(ih-FontSize/2)+3,0,txt);
the text is to high.
Right now I am fixing it by inserting the following lines between Crop and Annodate:
>status=MagickSetImageFormat(magick_wand_copy,"bmp");
>m = MagickGetImageBlob(magick_wand_copy, &l);
>DestroyMagickWand(magick_wand_copy);
>magick_wand_copy = NewMagickWand();
>MagickSetImageFormat(magick_wand_copy,"bmp");
>MagickReadImageBlob(magick_wand_copy,m,l);
And - it works!
How can I avopid putting that extra code in ?
thanks
Roland

Re: Annotate after Crop - unexpected x,y position

Posted: 2008-04-12T08:34:45-07:00
by magick
Try MagickResetImagePage().

Re: Annotate after Crop - unexpected x,y position

Posted: 2008-04-12T10:17:39-07:00
by roladdon
MagickResetImagePage - not found
I am using ImageMagick-6.2.8-Q16
- I gues it's time to update

but - it will have to wait a little bit till I have time.

Re: Annotate after Crop - unexpected x,y position

Posted: 2008-04-12T10:35:03-07:00
by magick
Ok, use MagickSetImagePage(wand,0,0,0,0).

Re: Annotate after Crop - unexpected x,y position

Posted: 2008-04-12T12:35:34-07:00
by roladdon
Ok - I updated to the newest version (I work in CBuilder - so it's more work)
now it works! thanks

new problem now: MagickContrastStretchImage() does not work anymore
Where can I find the exact definition for the input parameters - Black_Point & White_Point ?
like - valid range ..... - I know the range is from 0 to QuantumRange
so MagickContrastStretchImage(0,QuantumRange) should not change the image - but that's not the case

thanks,

Roland

Re: Annotate after Crop - unexpected x,y position

Posted: 2008-07-16T17:16:06-07:00
by anthony
See the recently added docs for the CLI API on -level
http://imagemagick.org/Usage/colors/#level

There is also a 'Levelize' type function that provides the reverse of 'Level' (equivelent to the new "+level" option in the latest release.

ContrastStretch function is basically a normalize type function, and not a good one at that! It hould be re-designed to mak use of Level, to adjust colors rather than histogram bins, as it currently does.