This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shannon entropy | |
const entropy = str => { | |
return [...new Set(str)] | |
.map(chr => { | |
return str.match(new RegExp(chr, 'g')).length; | |
}) | |
.reduce((sum, frequency) => { | |
let p = frequency / str.length; | |
return sum + p * Math.log2(1 / p); | |
}, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Simple GIMP script for batch filter operations. Will retain transparency. Intended input image format is PNG. | |
; Made this for the purpose of adding drop shadows and other filters to Shimeji imagesets. Save this file | |
; to ~/.gimp scripts/ . Execute in the directory containing the images you wish to modify : | |
; gimp-console -b '(batch-drop-shadow "*.png" 0 0 4)' -b '(gimp-quit 0)' | |
; Where 0 0 4 is the x offset, y offset and the radius for the drop shadow. | |
; For more information on how to apply other filters, check out Filters -> Script-Fu -> Console -> Browse in GIMP | |
(define (batch-drop-shadow pattern | |
offsetx |