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

How to remove the black background of gpuimage #284

Open
TroyRay opened this issue Apr 26, 2016 · 7 comments
Open

How to remove the black background of gpuimage #284

TroyRay opened this issue Apr 26, 2016 · 7 comments

Comments

@TroyRay
Copy link

TroyRay commented Apr 26, 2016

How to remove the black background of gpuimage?

@JitenNumberTank
Copy link

+1

@DzwsGo
Copy link

DzwsGo commented Sep 22, 2016

please

@Hitexroid
Copy link

it's my question too .

@thinhdt
Copy link

thinhdt commented Nov 6, 2017

My issue . Can anyone help me ? Thanks

@Seddiks
Copy link

Seddiks commented Feb 11, 2018

anyone found solution?

@tochange
Copy link

??

@milan15440
Copy link

You can use set ascept ratio method on GPUImageView
gpuImageView.setRatio(getDecimalEquivalent(bitmap.width,bitmap.height))
gpuImageView.setImage(bitmap)

private fun getDecimalEquivalent(width: Int, height: Int): Float {
val factor = greatestCommonFactor(width, height)
val widthRatio: Float = width / factor
val heightRatio: Float = height / factor
return widthRatio / heightRatio
}

private fun greatestCommonFactor(width: Int, height: Int): Float {
    return if (height == 0) width.toFloat() else greatestCommonFactor(height, width % height)
}

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

8 participants