test_class.file: app/src/test/java/org/unicef/rapidreg/utils/ImageCompressUtilTest.java
test_class.identifier: ImageCompressUtilTest
test_case.body: @Test
      public void should_return_sample_size_when_give_req_which_ratio_is_more_than_2_less_than_4() throws Exception {
          BitmapFactory.Options options = createBitmapFactoryOptions(9, 6);
          int actual = calculateInSampleSize(options, 3, 2);
          assertThat("Should return 3 when ratio is 3.", actual, is(3));
  
      }
test_case.class_method_signature: ImageCompressUtilTest.should_return_sample_size_when_give_req_which_ratio_is_more_than_2_less_than_4()
test_case.full_signature: @Test public void should_return_sample_size_when_give_req_which_ratio_is_more_than_2_less_than_4()
test_case.identifier: should_return_sample_size_when_give_req_which_ratio_is_more_than_2_less_than_4
test_case.invocations: createBitmapFactoryOptions calculateInSampleSize assertThat is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_return_sample_size_when_give_req_which_ratio_is_more_than_2_less_than_4()
focal_class.file: app/src/main/java/org/unicef/rapidreg/utils/ImageCompressUtil.java
focal_class.identifier: ImageCompressUtil
focal_class.class_method_signature: ImageCompressUtil.convertImageToBytes(Bitmap imageSource)
focal_class.full_signature: public static byte[] convertImageToBytes(Bitmap imageSource)
focal_class.identifier: convertImageToBytes
focal_class.modifiers: public static
focal_class.parameters: (Bitmap imageSource)
focal_class.return: byte[]
focal_class.signature: byte[] convertImageToBytes(Bitmap imageSource)
focal_class.class_method_signature: ImageCompressUtil.rotateBitmapByExif(String srcPath, Bitmap bitmap)
focal_class.full_signature: public static Bitmap rotateBitmapByExif(String srcPath, Bitmap bitmap)
focal_class.identifier: rotateBitmapByExif
focal_class.modifiers: public static
focal_class.parameters: (String srcPath, Bitmap bitmap)
focal_class.return: Bitmap
focal_class.signature: Bitmap rotateBitmapByExif(String srcPath, Bitmap bitmap)
focal_class.class_method_signature: ImageCompressUtil.recycleBitmap(Bitmap bitmap)
focal_class.full_signature: public static void recycleBitmap(Bitmap bitmap)
focal_class.identifier: recycleBitmap
focal_class.modifiers: public static
focal_class.parameters: (Bitmap bitmap)
focal_class.return: void
focal_class.signature: void recycleBitmap(Bitmap bitmap)
focal_class.class_method_signature: ImageCompressUtil.storeImage(Bitmap image, String saveFilePath)
focal_class.full_signature: public static void storeImage(Bitmap image, String saveFilePath)
focal_class.identifier: storeImage
focal_class.modifiers: public static
focal_class.parameters: (Bitmap image, String saveFilePath)
focal_class.return: void
focal_class.signature: void storeImage(Bitmap image, String saveFilePath)
focal_class.class_method_signature: ImageCompressUtil.compressImage(String filePath, float maxWidth, float maxHeight)
focal_class.full_signature: public static Bitmap compressImage(String filePath, float maxWidth, float maxHeight)
focal_class.identifier: compressImage
focal_class.modifiers: public static
focal_class.parameters: (String filePath, float maxWidth, float maxHeight)
focal_class.return: Bitmap
focal_class.signature: Bitmap compressImage(String filePath, float maxWidth, float maxHeight)
focal_class.class_method_signature: ImageCompressUtil.compressByQuality(Bitmap bitmap, int maxSize)
focal_class.full_signature: public static Bitmap compressByQuality(Bitmap bitmap, int maxSize)
focal_class.identifier: compressByQuality
focal_class.modifiers: public static
focal_class.parameters: (Bitmap bitmap, int maxSize)
focal_class.return: Bitmap
focal_class.signature: Bitmap compressByQuality(Bitmap bitmap, int maxSize)
focal_class.class_method_signature: ImageCompressUtil.calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight)
focal_class.full_signature: public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight)
focal_class.identifier: calculateInSampleSize
focal_class.modifiers: public static
focal_class.parameters: (BitmapFactory.Options options, int reqWidth, int reqHeight)
focal_class.return: int
focal_class.signature: int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight)
focal_class.class_method_signature: ImageCompressUtil.readImageFile(String filePath)
focal_class.full_signature: public static Blob readImageFile(String filePath)
focal_class.identifier: readImageFile
focal_class.modifiers: public static
focal_class.parameters: (String filePath)
focal_class.return: Blob
focal_class.signature: Blob readImageFile(String filePath)
focal_method.body: public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
          final int height = options.outHeight;
          final int width = options.outWidth;
          int inSampleSize = 1;
  
          if (height > reqHeight || width > reqWidth) {
              final int heightRatio = Math.round((float) height / (float) reqHeight);
              final int widthRatio = Math.round((float) width / (float) reqWidth);
              inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
          }
          float totalPixels = width * height;
          float totalReqPixelsCap = reqWidth * reqHeight * 2;
          while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) {
              inSampleSize++;
          }
          return inSampleSize;
      }
focal_method.class_method_signature: ImageCompressUtil.calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight)
focal_method.full_signature: public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight)
focal_method.identifier: calculateInSampleSize
focal_method.invocations: round round
focal_method.modifiers: public static
focal_method.parameters: (BitmapFactory.Options options, int reqWidth, int reqHeight)
focal_method.return: int
focal_method.signature: int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight)