docs: public static byte[] compressToByteArray(@NonNull final Bitmap bitmap,
                                               @NonNull final CompressFormat format,
                                               final int quality) throws IOException {
          Condition.INSTANCE.ensureNotNull(bitmap, "The bitmap may not be null");
          Condition.INSTANCE.ensureNotNull(format, "The format may not be null");
          Condition.INSTANCE.ensureAtLeast(quality, 0, "The quality must be at least 0");
          Condition.INSTANCE.ensureAtMaximum(quality, 100, "The quality must be at maximum 100");
          ByteArrayOutputStream outputStream = null;
  
          try {
              outputStream = new ByteArrayOutputStream();
              boolean result = bitmap.compress(format, quality, outputStream);
  
              if (result) {
                  return outputStream.toByteArray();
              }
  
              throw new IOException("Failed to compress bitmap to byte array using format " + format +
                      " and quality " + quality);
          } finally {
              StreamUtil.INSTANCE.close(outputStream);
          }
      }