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

Support image-rendering #449

Closed
magsout opened this issue May 13, 2015 · 18 comments
Closed

Support image-rendering #449

magsout opened this issue May 13, 2015 · 18 comments
Milestone

Comments

@magsout
Copy link
Member

magsout commented May 13, 2015

input.css

foo {
  image-rendering: pixelated;
}

output.css

foo {
/* IE */
  -ms-interpolation-mode: nearest-neighbor;
  /* Firefox */
  image-rendering: -moz-crisp-edges;
  /* Safari */
  image-rendering: -webkit-optimize-contrast;
  /* Chrome and Opera */
  image-rendering: pixelated;
}

source : http://www.simevidas.com/2015/05/10/Blowing-up-pixel-art-on-the-Web.html and http://dev.w3.org/csswg/css-images-3/#the-image-rendering

@ai
Copy link
Member

ai commented May 13, 2015

@magsout what you mean? What is bad in current workaround? What we should add to Autoprefixer?

@magsout
Copy link
Member Author

magsout commented May 13, 2015

oops I deleted the beginning of my message

If it were possible to add support for this property in autoprefixer

@ai
Copy link
Member

ai commented May 13, 2015

@ai
Copy link
Member

ai commented May 13, 2015

I found a problem. You need to set input:

foo {
  image-rendering: crisp-edges;
}

@ai
Copy link
Member

ai commented May 13, 2015

We can also set this behaviour to pixelated value.

@ai ai added the 5.2 label May 13, 2015
@magsout
Copy link
Member Author

magsout commented May 13, 2015

thanks 👍

@ai
Copy link
Member

ai commented May 13, 2015

@yisibl @simevidas are you agree that we should have some prefixed values for pixelated and for crisp-edges?

@magsout
Copy link
Member Author

magsout commented May 13, 2015

@ai there are 3 values : auto crisp-edges pixelated

See http://dev.w3.org/csswg/css-images-3/#the-image-rendering

@simevidas
Copy link
Contributor

@ai The problem is that the 3 prefixed declarations:

-ms-interpolation-mode: nearest-neighbor;
image-rendering: -moz-crisp-edges;
image-rendering: -webkit-optimize-contrast;

behave like image-rendering: pixelated. The spec includes screenshots which show that pixelated fully preserves pixels, whereas crisp-edges does not. If I remember correctly, Mozilla even acknowledged that their -moz-crisp-edges algorithm corresponds to the spec’s pixelated algorithm.

Maybe the state of implementations is too unstable for Autoprefixer. My current recommendation is to use a CSS utility class for the “preserve pixels” use case, anyway.

@ai
Copy link
Member

ai commented May 13, 2015

@simevidas for example, Autoprefixer adds prefixes for flexbox even if specs has big difference.

If -moz-crisp-edges is equal to pixelated, it is OK.

But maybe we should not add prefixes for crisp-edges if all prefixed values do different thing?

@simevidas
Copy link
Contributor

@ai Ah oh. All 3 prefixed declarations correspond to image-rendering: pixelated since they fully preserve pixels. For the crisp-edges algorithm, there are no prefixes that I am aware of.

@ai
Copy link
Member

ai commented May 13, 2015

@simevidas so, what you think about this plan to 5.2:

  1. Remove prefixes for crisp-edges
  2. Add warning on crisp-edges.
  3. Add prefixes for pixelated

Is there some case, when user will write crisp-edges right now?

@simevidas
Copy link
Contributor

Sounds good. I’ve checked Mozilla, Chromium, and WebKit bug trackers. The crisp-edges value/algorithm is not even in development anywhere.

@ai
Copy link
Member

ai commented May 16, 2015

@ai ai closed this as completed May 16, 2015
@yisibl
Copy link
Member

yisibl commented May 18, 2015

Good job!

@magsout
Copy link
Member Author

magsout commented May 20, 2015

👍 thanks

@ai ai modified the milestone: 5.2 Jan 14, 2016
@ai ai removed the 5.2 label Jan 14, 2016
@mathiasbynens
Copy link

I don’t understand why this change (“1. Remove prefixes for crisp-edges”) was made… image-rendering: -moz-crisp-edges; should not be stripped as it’s still the only way to achieve this effect in Firefox. Am I missing something here?

http://caniuse.com/#feat=css-crisp-edges

@mathiasbynens
Copy link

Turns out what I was missing was this bug: #632.

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

5 participants