Converting images in app to raw image binary

Hi! I am using an API which states that images should be passed as ‘raw image binary’ in the POST body request. I’ve been trying to find a function to convert the jpg/png images I am using in my xcode project to raw binary, but I am really struggling. Does anyone know if there is an easy way to do this?

Thanks!

There’s a jpegData() and pngData() function on a UIImage

This will convert it to “data” not 100% sure if that means “raw image binary” though.

Begin looking at the docs for UIImage and you’ll find what I’m talking about