Rotate in 3 dimensions a 2D image that contains a transparent channel?

(David) #1

Hello,

I would like to rotate in 3 dimensions a 2D image that contains a transparent channel.

With my command gmic, it does not work because I use a box3d.

Do you have an idea to rotate the heart while maintaining transparency?

Thank you

gmic s=400 picture.png -box3d $s,$s,0 -texturize3d[-1] [-2] -remove[0] -gimp_render3d[0] $s,$s,.70,0,45,0,45,0,0,-100,.5,.7,2 -o result.png

picture.png :
c6c93d90b17f1ab97938160e1cd5c99d966f7d0f

result.png :
result

(David) #2

David, do you have an idea to answer my problem?
I just want to rotate a 2D image in 3D while keeping the transparency. I don’t know if this is possible with gmic.
Thank you.

#3

@David_Tschumperle can be a busy guy.

Allow me to make some suggestions in the meantime. Let’s think through the problem. G’MIC doesn’t care about transparency the way you regard it. The alpha channel is just another colour channel. Use the alpha to mask the heart shape.

  1. Separate it from the heart.
  2. Do transformations on both the heart and the mask, respectively.
  3. For each frame, mask the transformed hearts with the transformed masks.

Now the masking will be used in a blend such that you will have the heart on top of something. ImageMagick, which is what G’MIC uses to assist it with (animated) GIFs, may be a better app to use if you need more control of transparencies, alphas, composites, animations, etc. I am sure you could do the same with G’MIC but there is power in the builtin functions of IM.

(David) #4

Thanks afre.

In fact, I already know how to do this with IM but I want to use gmic because it is much faster to generate images with perspective (the goal is to create an animation so with a lot of calculation).

Your idea is very interesting but it requires 2 times more calculation, for the starting image and then for the mask and that for each frame that will compose the animation.

If there is no other more dynamic solution, I will generate the different frames of the mask (heart) and I will apply them on the final animation.