Shoaib Chikate
Shoaib Chikate

Reputation: 8975

Invalid JPEG file structure: missing SOS marker

Firstly,I captured image using Phonegap 3.0 which gives me BASE64 encoded String and then I have converted BASE64 string into MultipartFile object using How to convert byte array to MultipartFile link.

scalePhoto(ORIGINAL_LONG_EDGE,(new BASE64DecodedMultipartFile(Base64.decodeBase64(base64EncodedString).getBytes())

Check link for above class.

I am getting

Invalid JPEG file structure: missing SOS marker.

How can i resolve that?

Upvotes: 0

Views: 3969

Answers (1)

Csaba Toth
Csaba Toth

Reputation: 10697

Obviously something gets lost during the conversion or the inverse conversion.

  1. check the if your JPEG handling code can handle the JPEG file produced by Photoshop, in other words, get rid of the Base64 encoding/decoding and the multi-part file stuff. Isolate the JPEG and feed the "real" data.
  2. Binary compare the original JPEG and the binary file what you get at the end of the base64decode and multi-part join operations. Probably the wont' be the same.
  3. Isolate only the Base64 encoding/decoding and test that with the JPEG file. (binary compare the the JPEG files again).
  4. Isolate only the multi-part break up and join to see if that loose any info. (binary compare the the JPEG files again).

Upvotes: 1

Related Questions