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

Fixed wrong image resize due to the use of backingScaleFactor instead… #3

Closed
wants to merge 1 commit into from
Closed

Conversation

jaeggerr
Copy link

@jaeggerr jaeggerr commented Oct 3, 2016

… of using the real image size in pixels

Hi!

If had an issue when trying to downscale images.
For example, an @3x image of 180x180 px gives me:
@2x => 90x90px
@1x => 45x45px

The expected results are
@2x => 120x120px
@1x => 60x60px

The issue is due to the use of NSScreen backingScaleFactor to calculate the real size of the image. I have a screen with a backingScaleFactor of 1.

I corrected the code so that we don't calculate the real image size based on the screen scale factor but by using the real image data.

@terwanerik
Copy link
Owner

This breaks it on Retina screens, if i drag a 300x300px image (@3x) it generates a 400x400 2x and a 200x200 1x image. I'll try to combine the 2 methods, taking the backingScaleFactor and the image data scale factor. Thanks for the heads up!

@terwanerik
Copy link
Owner

Could you check it with this code? I only have Retina Macs. #4

@terwanerik terwanerik closed this Oct 3, 2016
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

Successfully merging this pull request may close these issues.

None yet

2 participants