mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-03 21:46:20 +00:00
21 lines
471 B
JavaScript
21 lines
471 B
JavaScript
// Aseprite
|
|
// Copyright (C) 2015-2016 by David Capello
|
|
|
|
var col = app.pixelColor
|
|
var img = app.activeSprite
|
|
|
|
for (y=0; y<img.height; ++y) {
|
|
for (x=0; x<img.width; ++x) {
|
|
var c = img.getPixel(x, y)
|
|
var v = (col.rgbaR(c)+
|
|
col.rgbaG(c)+
|
|
col.rgbaB(c))/3
|
|
|
|
img.putPixel(x, y,
|
|
col.rgba(col.rgbaR(c),
|
|
col.rgbaG(c),
|
|
col.rgbaB(c),
|
|
255-v))
|
|
}
|
|
}
|