Annotate after Crop - unexpected x,y position

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
roladdon

Annotate after Crop - unexpected x,y position

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

Re: Annotate after Crop - unexpected x,y position

Post by magick »

Try MagickResetImagePage().
roladdon

Re: Annotate after Crop - unexpected x,y position

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

Re: Annotate after Crop - unexpected x,y position

Post by magick »

Ok, use MagickSetImagePage(wand,0,0,0,0).
roladdon

Re: Annotate after Crop - unexpected x,y position

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Annotate after Crop - unexpected x,y position

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply