title: Image from database is coming out cropped in Android Studio
body: <p>I am using Kotlin in AS and am relatively new to it so I will try to explain as best I can. I am also using a database that stores food products and their images.</p>
  <p>I am converting a varbinary to a bitmap and setting the bitmap in a viewHolder that is a place holder for my images. When running my app, the image is</p>
  <p><a href="https://i.stack.imgur.com/MhtZF.png" rel="nofollow noreferrer">cutoff as shown</a></p>
  <p>and I'm unsure why it is being cut off as such.</p>
  <p>For now, I am hardcoding in one of the records from my image column</p>
  <pre><code>val imageText = &quot;89504E47...&quot;
  </code></pre>
  <p>and setting the image bitmap by running the string into a function that gets the bitmap and sets it to my viewHolder</p>
  <pre><code>viewHolder.productImg.setImageBitmap(getBitmap(imageText))
      /**
   * Converts a hex string to Bitmap
   *
   * @param image  hex string e.g. &quot;FFD8FFE0...&quot;
   * @return Bitmap
   */
  private fun getBitmap(image: String): Bitmap {
      // Convert String to ByteArray
      val byteArray = Hex.stringToBytes(image)
      // Convert ByteArray Bitmap
      return BitmapFactory.decodeByteArray(byteArray, 0, byteArray.size)
  }
  </code></pre>
  <p>I tried playing with the XML that contains the ImageView but that does nothing</p>
  <pre><code>        &lt;ImageView
          android:id=&quot;@+id/product_item_pic&quot;
          android:layout_width=&quot;150dp&quot;
          android:layout_height=&quot;150dp&quot;
          android:src=&quot;@drawable/ic_fastfood_24&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          /&gt;
  </code></pre>
  <p>Please help and I can answer any follow up questions the best I can, thanks!</p>