Skip to content

Instantly share code, notes, and snippets.

@avanderw
Last active February 22, 2024 06:15
Show Gist options
  • Save avanderw/5850094 to your computer and use it in GitHub Desktop.
Save avanderw/5850094 to your computer and use it in GitHub Desktop.
The following color matrix filter will grayscale an image.
private const matrix:Array = [
0.3, 0.59, 0.11, 0, 0,
0.3, 0.59, 0.11, 0, 0,
0.3, 0.59, 0.11, 0, 0,
0, 0, 0, 1, 0];
private const zero:Point = new Point();
grayscale.bitmapData.applyFilter(image.bitmapData, image.getRect(image), zero, new ColorMatrixFilter(matrix));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment