Skip to content

Requested resolution not set for the photo. #214

Open
@bipinvaylu

Description

@bipinvaylu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions