I have an image and have a gray mask, I am trying to use fast composite displace to move image but after image is moved it is leaving behind edges:
magick flower.jpg flower_depth.png -virtual-pixel Gray -compose Displace -define compose:args=-30x0 -composite flower_result.jpg
Any help would be appreciated, I want to use this fast processing approach... tried very hard even chatgpt is not able to come up with any good solution :D



Same problem in Gimp...
And when I look at your image, the displace map exactly overlays the source image, and you are using a negative displacement, two hints that you have fallen victim to a very common misconception.
The misconception
Displace maps would describe what happens to the source pixels; in other words, the map would tell how to move the matching source pixel. This is wrong, and there are at least two problems with this assumed behavior:
The reality (*)
The map tells where the corresponding result pixel comes from (which is unambiguous, and every pixel in the result has a source...).
A corollary is that the displace map shape is usually different from the source, you cannot deduce it simply from the source.
Your problem
If you look at your map up close:
So in:
So you get ellipse-background-ellipse and you see a gap.
If you want to stretch that part, the background and the ellipse should be moved by roughly the same amount, so the displace map cannot have a hard edge, in should on the contrary be uniform (or have a very slow gradient)(this is an application of the corollary above).
However....
Going back to the initial problem, what are you trying to achieve, because I don't think the displace map is a solution... (ask a new question if so).
(*) At least in Gimp, but I can reasonably assume that it works like other software