Per T220171 - this issue has been happening for a while, and the previous suggestion was to use VIPS, but there has been some back-and-forth about whether that remains the best solution. So, this spike will primarily focus on determining how we can best avoid OOM errors (VIPS is a valid answer, but it's unclear to me at this time whether it will be).
Further, given that this ticket is in an area that the team is relatively unfamiliar with, it would be helpful to offer some guidance on the proposed solution in order to further assist whoever picks up the ticket.