Is it possible to upload image binary in the pre-request script?

We have a requirement to upload image binary dynamically through a script.

Is it possible to upload image binary in the pre-request script?