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

af_imageAspectScaled(size:) adds a white padding #417

Open
dvertovsek opened this issue Apr 20, 2020 · 0 comments
Open

af_imageAspectScaled(size:) adds a white padding #417

dvertovsek opened this issue Apr 20, 2020 · 0 comments

Comments

@dvertovsek
Copy link

dvertovsek commented Apr 20, 2020

What did you do?

I called UIImage.af_imageAspectScaled(size: CGSize(2400, 2400))

What did you expect to happen?

IMG_0782

What happened instead?

white padding around the image

IMG_0781

AlamofireImage 3.5.2

If anyone encounters this problem:

Basically, replace the line inside UIImage.imageAspectScaled method

let origin = CGPoint(x: (size.width - scaledSize.width) / 2.0, y: (size.height - scaledSize.height) / 2.0)

with

let origin = .zero

AND

UIGraphicsBeginImageContextWithOptions(size, false, 0.0)

with

UIGraphicsBeginImageContextWithOptions(scaledSize, false, 0.0)

Can i add a PR ?

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