Search code examples
swiftjpeguiimagejpegrepresentation

UIImageJPEGRepresentation generates JPEG without SOI Marker


I'm generating JPEG image data using UIImageJPEGRepresentation(UIImage, 1.0) in Swift version 4(?).

I'm using a 3rd party JPEG decoder but it throws an error that no SOI (start of image) marker was found.

How do I generate a correctly formatted JPEG with SOI markers in Swift (preferably) or Objective-C?

Is this a known issue in standard Swift and should I start looking at 3rd party JPEG encoders?


Solution

  • Resolving under the assumption that the fault lies in the decoder and not UIImageJPEGRepresentation.