Alamofire encodes image in which format?

426 Views Asked by At

I am using alamofire to send Image to server with multipart.

multipartFormData.append(UIImageJPEGRepresentation(self.imageDet[0].image!,0.5)!, withName: "filestream", mimeType: "image/jpeg")

I have the image in byte format from server side.

Here is an example of the bytes I receive at the server side

    ����JFIFHH��XExifMM*�i&�������8Photoshop 3.08BIM8BIM%��ُ��  ���B~����"��    
���}!1AQa"q2���#B��R��$3br� 
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���������������������������������������������������������������������������    
���w!1AQaq"2�B����  #3R�br�
$4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������C

How can I convert the following data back to image?

1

There are 1 best solutions below

7
LorenzOliveto On

The images are encoded in JPEG and converted in binary form (Data or NSData) when you write UIImageJPEGRepresentation(...). Then this binary data is sent to the server.