0.1.0 • Published 6 years ago
toepler v0.1.0
toepler
convert images to audio and vice versa
API
toWav(image, options)
Returns a Promise<Buffer>
for a 24-bit, mono .wav
file.
image
: Type:Buffer
. Expects theBuffer
to be a.jpg
image by default (can be changed by settingoptions.inputType
).options
: Type:Object
inputType
: Type:string
. Default:'image/jpeg'
. MIME type of the input image buffer. Only'image/png'
and'image/jpeg'
are supported. Any.png
transparency information will be discarded.sampleRate
: Type:number
. Default:44100
. The sample rate of the output.wav
.
toImage(sound, options)
Returns a Promise<Buffer>
for a 24-bit .jpg
file.
sound
: Type:Buffer
. Expects aBuffer
of a 24-bit, mono.wav
file.options
: Type:Object
width
: Type:number
. Minimum:1
. The width of the image to output. If there are not enough samples to fill the image, the remaining pixels will be left black. If there are too many samples, the excess samples will be discarded. Missing dimensions will be extrapolated from the available samples and dimensions.height
: see width.- outputType: Type:
string
. Default:'jpg'
. The type of image to output. Can be'png'
or'jpg'
License
0.1.0
6 years ago