Position one image on another

Hello everyone,

I just want to position one image on another, centering it, how can I do?

With imagemagick just do:

composite -compose Over -gravity center

How to do with gmic?

Here are the two images that I want to superpose:

gmic photo.jpg --mirror[-1] x -imagegrid_triangular[0] 6,10,3,0.5 -resize[0] 120%,120%

Thank you !

Not sure how you want to superpose them. Adding something as j[0] [1],10%,10% rm[-1] at the end of your command line would be enough maybe ?

image

is equivalent to

gmic smile.gif split_opacity rose.jpg image[2] [0],{(70-48)/2},0,0,0,1,[1],255 keep[2]

Remarks

  • split_opacity extracts the alpha channel from smile.gif into a separate image.
  • See: http://gmic.eu/reference.shtml#image
  • {(70-48)/2} centres smile.gif over rose.jpg over the x-axis.
  • Values 0 to 2 in [] selects the appropriate images to act upon.

70 and 48 could be replaced with w#0 and w#1.

Didn’t want to complicate matters with more syntax.

Thank you all!

Cheers. Just curious: What made you decide to use G’MIC in the place of ImageMagick? If you need any help with IM, just ask @snibgo. He is on the IM forums too. Both are useful but nowadays I use G’MIC most of the time.

gmic is much faster to run some nice 3D animations (the calculations are done natively) unlike Imagemagick or you had to write a lot of code. A good example is the 3d cube, impossible to create directly with Imagemagick, you must write yourself all the calculations of position of the faces (or use script ex: Fred's ImageMagick Scripts: 3DBOX). It’s a lot longer to run …
I want to avoid using Imagemagick as much as possible when I’m using gmic to improve the speed of the final render.

1 Like

For the benefit of people searching an answer to this, here’s another answer to this.

s.. c,-{s#-2-1} image[-1] [-3],.5~,.5~,0,0,1,[-2],255 k.

First, split the last channel. Then apply the original[-2] image on top of -1 image with the information found with the image that was separated. I’m pretty sure this can work with CMYKA.

EDIT:

How would I position the center of image into the 0,0 of the target image?

EDIT #2:

The solution to above would be

s.. c,-{s#-2-1} image[-1] [-3],-{w#-3/2},-{h#-3/2},0,0,1,[-2],255 k.

Now, I think I know how to make another paint net plugin for g’mic. I have something in mind. :slight_smile: