Crop to size + Fit to size

Two simple nodes that are missing and make hellsome macros.

Crop to size - Just like the built-in crop, except that it always outputs to its defined size, ie if the image size is smaller than the crop size, this node pads it out with rgba 0,0,0,0.

Fit - Takes an image input, scales it to completely fill its defined size, then crops any excess resulting from mismatched aspect ratios. voila: your input now fits the defined size.

smokris's picture

These could be implemented as Executable CoreImage filters, I think? (rather than Quartz Composer Patches)

cwright's picture
mismatched ratio

When tossing stuff from mismatched ratios for fit-to-size, you've got some options. So, this would need a top/bottom or left/right percent selector to determine where to begin tossing out the data. Is this a correct assumption?

smokris's picture
Placement input?

So there would be an input called "Placement" where "0.0" = keep the left(top) side, chop off from the right(bottom); "0.5" = center the image / chop off left(top) and right(bottom) equally; and "1.0" = keep the right(bottom) side, chop off from the left(top)?

cwright's picture
what about mixes?

what if you want choppage on both sides? (for example, remove 50% from the top, 50% from the bottom, etc) That's why I suggested a percentage input to pick how much from each side to remove.

smokris's picture

That's what I meant by "0.5" = center the image / chop off left(top) and right(bottom) equally.

You could also use "0.4" to mean "chop off 40% from the left and 60% from the right".

cwright's picture
normalized is way better

I like normalized way better. good idea. :)

tobyspark's picture
thats a deluxe option, but yep

and yep to a normalised figure.

Just.Jake's picture

this is fairly simple to do as a macro/clip; I think it'd take about 5 min. I'm on my I phone, but when I get back to my computer I'll upload the macros I have set up for this.

tobyspark's picture
leopard has the goods

image resize has fill and fit options. huzzah.