mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Add support for bit depth with raw input and output (#2762)
* Determine input raw pixel depth from the given typed array * Allow pixel depth to be set on raw output
This commit is contained in:
@@ -748,7 +748,16 @@ function heif (options) {
|
||||
*
|
||||
* @returns {Sharp}
|
||||
*/
|
||||
function raw () {
|
||||
function raw (options) {
|
||||
if (is.object(options)) {
|
||||
if (is.defined(options.depth)) {
|
||||
if (is.string(options.depth) && is.inArray(options.depth, ['char', 'uchar', 'short', 'ushort', 'int', 'uint', 'float', 'complex', 'double', 'dpcomplex'])) {
|
||||
this.options.rawDepth = options.depth;
|
||||
} else {
|
||||
throw is.invalidParameterError('depth', 'one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex', options.depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this._updateFormatOut('raw');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user