positioning issue with bitmaps.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rhytha
Posts: 1
Joined: 2012-08-27T23:27:26-07:00
Authentication code: 67789

positioning issue with bitmaps.

Post by rhytha »

Hi

i am newbie to the forum as well as IM.

Thank you for the IM in the first place, with it we will be no where near what we would like to get done, so a big thank you to the IM team.

I like to know how best to handle the specific problem we are having with positioning.

We have a background image where we would like to place bitmaps based on the words entered by a user. Like if a user enters IMAGE MAGIK we would like to add it to the image with different perspective and distortions as you can see in the below image. First what we do is montage the bitmaps and apply the effects like distortation etc and then composite over the image.

Image


The problem i am having is in the position of the bitmaps, there is considerable difference between the words, IMAGE MAGIK, image magik and Image Magik !! with some special chars, though the geometry values are like below for each of the above words, the position of the image

geometryX="+515" geometryY="+575" gravity="NorthWest"

but for the each of the above bitmaps the image is getting positioned at differently as you can see the below images.


Image
Image
Image


I have attached the full zip file of the above images with the bitmaps if anyone likes to download.

http://www47.zippyshare.com/v/82193716/file.html

can anyone give us the write direction on how to achieve consistent positioning for different bitmaps??

thank you

MK
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: positioning issue with bitmaps.

Post by anthony »

The origin of the image is in a different location in each of the two distorted images, As such the text 'moved'. Using the lower level 'composite' operator can not solve this problem.

See... IM examples... Positioning Distorted Perspective Images
http://www.imagemagick.org/Usage/layers/#layer_distort

Distort the image using +distort. the 0,0 point in the original image will then be preserved (unless distort translated the image as part of the distort). Better still, do the translation and positioning as part of the distort. That way you can get perfect sub-pixel allignment of the two images.

The distorted (and positioned) image is then 'layered' (using flatten or merge operators) onto the background, perfectly.

NOTE complex coordinate calculation is only needed if the control points used for distortion, does not match the positioning control point used for placement. But the above link does go into doing even that level of complexity too.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply