You can write a custom pipeline component. Is the jpg the only data you wish to keep from the message. If not you will have to create a multi-part message in the pipeline. i.e. keep the data part and add a binary jpg image part. If you only wish to pass the jpg image, then you can just replace the received data stream with a jpg data stream.
You could also do this in an orchestration using a custom .Net class