This is how I simply upload images to Imgur using Alamofire and Swift:
let url = URL(string: "https://api.imgur.com/3/upload")!
private var headers: [String: String] {
["X-Token": "[mytokenhere]", "Authorization": "Client-ID [myidhere]"]
}
Alamofire.upload(multipartFormData: { multipart in
if let data = UIImagePNGRepresentation(image.image) {
multipart.append(data, withName: "image", fileName: "image.png", mimeType: "image/png")
}
}, to: url, headers: headers, encodingCompletion: { result in
//convert result image from result here
})
Example before upload, original image (as you can see, it adds white background even here on SO, why?):
And after upload, returned url to an uploaded image:
Originally on computer and iPhone it look like this:



This is how Imgur behaves when your image size exceeds a limit - it converts your image into a JPEG. See the Imgur Help page on upload limits.
Note that for anonymous uploads, this limit is 1MB:
You can see that it has been turned into a JPEG by inspecting the response JSON. The "type" key would indicate the type of image actually uploaded. For example, this is returned when I anonymously uploaded a png larger than 1MB: