I wonder if there is any way to crop a image based on alpha data like this:

enter image description here

The reason I want to do this is that I want to crop the White area of another image (of the same dimension to the Alpha image above), then stretch it to fill the whole area, or fit to other expected dimension. And this has to be done in Compositor.

For example, this is a MANUAL way to crop then fit to expected dimension:

enter image description here

Blend File

However, to decide the value in Crop node is not so easy in order to get rid of unwanted part. So I wonder if there is any way (math or something?) that can be smart enough to save that work.

  • $\begingroup$ Related: blender.stackexchange.com/q/2376/599 $\endgroup$
    – gandalf3
    Jul 20, 2014 at 6:10
  • $\begingroup$ @gandalf3 Thanks. I know that post, but want I really want is to decide (or "guess") the cropped dimention based on the white area. All I know is it is a nice rectangle, but the exact dimension? No idea. $\endgroup$ Jul 20, 2014 at 6:20
  • $\begingroup$ I think the title contains everything: "a real crop based on Alpha data". $\endgroup$ Jul 20, 2014 at 6:30
  • 1
    $\begingroup$ Could you show a walk-through(using images) of what you would like to see using manual steps even if you have to use a 2D Editor to accomplish each step? BTW. It's good to see you back again. $\endgroup$ Jul 20, 2014 at 14:06
  • $\begingroup$ @MarcClintDion Thanks for that :D I've updated the question. Hope you can get what I'm trying to do. $\endgroup$ Jul 21, 2014 at 3:05

1 Answer 1


Use this node setup:

enter image description here

In the texture node, you open the image you want to use as a mask, then plug the alpha output from that to the scale node's input for X and Y (the scale node's "Coordinate Space" is set to relative), you grab you RenderLayer and shove it in the image input for the sacle node, and finally connect that to the composite node.

  • $\begingroup$ Hi, you can do it because the "Use Alpha" is toggled. I bet if it is untoggled, you can still see it is "uncropped" actually. So, this is not a real crop as I mentioned. I want the true change on dimension. $\endgroup$ Jul 22, 2014 at 1:12
  • $\begingroup$ Yeah, if it's not on, the area which would be transparent is actually black. $\endgroup$ Jul 22, 2014 at 8:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .