Cutting stock-like problem

I’m interested in any library or tutorial to solve a variant of the well-known “cutting stock problem”, like this for example.

My real case scenario is a bit different, though.
I have one image (either a 1-bpp bitmap or an SVG) with a closed shape (container) and some others with any pattern inside, but always with only 1 bit of information.

I want to move and scale each image (without rotating them) in order to best fit them inside the container image. I want to take care only of the “active” pixels, so I cannot rely on the bounding box.

Is there anything I can start with?