If you have access to Illustrator this can be done fairly easily with Jongware's CircleFill script.

Then to easily replace objects I recommend installing and using the wonderful copyToMultipleObjects script by John Wundes.
All you have to do is select one "flag circle" on the topmost layer/position above the shapes you want to replace and the script will copy it and scale it perfectly to match.
This works on anything, including bitmaps!

So your general workflow would look something like this:

To install these scripts, opposite click on the link and save it to your desktop or copy it to a notepad document and save it as "All Files" with a .js after the script name.
With Illustrator closed, navigate to your Illustrator's Script folder, which is in the following example location (the actual location will depend on your installation of Illustrator and language):
Windows: C:/Program Files/Adobe/Adobe Illustrator CC
2014/Presets/en_GB/Scripts
Mac OS: Applications/Adobe/Adobe Illustrator CC
2014/Presets/en_GB/Scripts
And paste a copy of the .js file into the folder and open Illustrator.