image-js
Version:
Image processing and manipulation in JavaScript
23 lines • 668 B
JavaScript
import { getOutputImage } from '../utils/getOutputImage.js';
import flipX from './flipX.js';
import flipY from './flipY.js';
/**
* Apply a flip filter to an image.
* @param image - Image to process.
* @param options - Flip options.
* @returns - The processed image.
*/
export function flip(image, options = {}) {
const { axis = 'horizontal' } = options;
const newImage = getOutputImage(image, options, { clone: true });
if (axis === 'horizontal') {
return flipX(newImage);
}
else if (axis === 'vertical') {
return flipY(newImage);
}
else {
return flipY(flipX(newImage));
}
}
//# sourceMappingURL=flip.js.map