The words "weed out" form a metaphor.
A metaphor is an imaginative way of describing something by referring to something else which is the same in a particular way. - Collins Cobuild Dictionary.
In the context you describe it seems an entirely appropriate metaphor because the process you describe of elimination unsatisfactory images is directly comparable to eliminating unsatisfactory plants from your garden.
There is no general rule that metaphors may not be used in formal writing. On the contrary, they are used all the time. 'Formal' does not mean 'dull'.
There are all sorts of ways in which metaphors can be misused, and many of these expose the writer to ridicule: "The Prime Minister is leading the people over the precipice with his head in the sand". So care is needed when you use a metaphor, but this case is fine.