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

[Feature request] Include dithering #1

Open
jorgerobles opened this issue Apr 1, 2017 · 1 comment
Open

[Feature request] Include dithering #1

jorgerobles opened this issue Apr 1, 2017 · 1 comment

Comments

@jorgerobles
Copy link

Hi @lautr3k we have a crush on dithering on this thread https://plus.google.com/+ClaudioPrezzi/posts/2aVG4KuaESB?fscid=z13sct1itoz5sthsd22pdfbazufhenlio04.1491053867286977

Could you add https://github.com/noopkat/floyd-steinberg to the filters? It's just a couple of lines:

import floyd_steinberg from 'floyd-steinberg'

...L#133...
settings = Object.assign({}, {
        smoothing   : false,  // Smoothing [true|fale]
        brightness  : 0,      // Image brightness [-255 to +255]
        contrast    : 0,      // Image contrast [-255 to +255]
        gamma       : 0,      // Image gamma correction [0.01 to 7.99]
        grayscale   : 'none', // Graysale algorithm [average, luma, luma-601, luma-709, luma-240, desaturation, decomposition-[min|max], [red|green|blue]-chanel]
        shadesOfGray: 256,    // Number of shades of gray [2-256]
        invertColor : false,  // Invert color...
       dither: false,
}, settings || {})

...L#190...
if (settings.dither) {
        floyd_steinberg(imageData)
}
@jorgerobles jorgerobles changed the title Include dithering [Feature request] Include dithering Apr 1, 2017
@jorgerobles
Copy link
Author

jorgerobles commented Apr 1, 2017

Or extend lw.canvas-grid to accept custom key callables, this way could be extended without recompiling all the toolchain.

filters: {
   ... your filters
   dithering: (imageData) => { ...process ImageData... }
}

Or a simple hook for further imageData processing

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