Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support high-quality image uploading #13

Open
akiomik opened this issue Mar 9, 2023 · 2 comments
Open

Support high-quality image uploading #13

akiomik opened this issue Mar 9, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@akiomik
Copy link
Owner

akiomik commented Mar 9, 2023

Currently:

  • Converted to bitmap
  • Resize image if necessary
  • Compress bitmap as jpeg
  • Upload jpeg

Expected:

  • Resize or compress if the size is larger than 1000px or 300KB
  • Upload in its original format

fun convertToUploadableImage(source: ImageDecoder.Source): ByteArray {
val bitmap = resizeImage(ImageDecoder.decodeBitmap(source))
val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream)
return stream.toByteArray()
}

@akiomik akiomik added enhancement New feature or request good first issue Good for newcomers labels Mar 9, 2023
@akiomik
Copy link
Owner Author

akiomik commented Mar 9, 2023

Maybe my understanding of the restrictions is wrong? (Someone uploads an image of 2000px height)

@akiomik
Copy link
Owner Author

akiomik commented Mar 9, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant