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

Requested resolution not set for the photo. #214

Open
bipinvaylu opened this issue Nov 30, 2023 · 0 comments
Open

Requested resolution not set for the photo. #214

bipinvaylu opened this issue Nov 30, 2023 · 0 comments

Comments

@bipinvaylu
Copy link

I am using this library to compress and update image resolution. But somehow, the Image doesn't convert to the requested resolution of 1500 x 1500.

Code:

private suspend fun compressImageMedia(image: Image): Either<Exception, Image> {
        return try {
            val sourceFile = File(image.url)
            val destinationFile = File(context.filesDir, sourceFile.name)

            val compressedImageFile = Compressor.compress(context, sourceFile) {
                resolution(1500, 1500)
                destination(destinationFile)
                quality(Constant.projectPhotosQuality)
                format(sourceFile.compressFormat())
            }

            Image(image.index, compressedImageFile.absolutePath).right()
        } catch (e: Exception) {
            Timber.e(e, "Image compression failed")
            e.left()
        }
    }

The actual image resolution is 3000 X 4000.
The output image resolution is 1500 X 2000 instead of 1125 X 1500.

Library version: 3.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant