title: jpeg image data is shifted in ios UIImageView
body: <p>I'm trying to send a jpeg image data from a tcp server to a tcp client and my client side device is an iphone mobile.</p>
  
  <p>I compressed bitmap data to jpeg data in the server with opencv using cv::imencode.</p>
  
  <p>If i send this image from server :
  <a href="https://i.stack.imgur.com/60DSM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/60DSM.png" alt="simple rendered red triangle in opengl"></a></p>
  
  <p>Then in the client side i have this image :
  <a href="https://i.stack.imgur.com/ULoTj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ULoTj.jpg" alt="iPhone 7 plus screenshot"></a></p>
  
  <p>As see ,the image is shifted one pixel per row! Also in swift i used from NSData for showing the received bytes to UIImage :</p>
  
  <pre><code>let dataImage = NSData(bytes: encodedData, length: dlen)
  let image = UIImage(data: dataImage as Data)
  uiImageView.image = image
  </code></pre>
  
  <p>I see encodedData array in ios side and that was exactly same with the server sent data, And before of testing this in iphone i tested that in android and there , everything was right but now seems iphone doesn't decode the image rightly.</p>
  
  <p>Does anyone know what is happening there?</p>