@expo/image-utils
Advanced tools
Comparing version 0.0.1-canary-20240320-8a10e09 to 0.0.1-canary-20240327-a7302d9
@@ -5,7 +5,7 @@ /// <reference types="node" /> | ||
import { ImageFormat, ImageOptions, ResizeMode } from './Image.types'; | ||
import { jimpAsync } from './jimp'; | ||
import { jimpAsync, createSquareAsync } from './jimp'; | ||
import { findSharpInstanceAsync, isAvailableAsync, sharpAsync } from './sharp'; | ||
import { SharpCommandOptions, SharpGlobalOptions } from './sharp.types'; | ||
export declare function imageAsync(options: SharpGlobalOptions, commands?: SharpCommandOptions[]): Promise<Buffer | string[]>; | ||
export { jimpAsync, findSharpInstanceAsync, isAvailableAsync, sharpAsync, generateImageAsync, generateFaviconAsync, Cache, compositeImagesAsync, getPngInfo, }; | ||
export { jimpAsync, createSquareAsync, findSharpInstanceAsync, isAvailableAsync, sharpAsync, generateImageAsync, generateFaviconAsync, Cache, compositeImagesAsync, getPngInfo, }; | ||
export { SharpGlobalOptions, SharpCommandOptions, ResizeMode, ImageFormat, ImageOptions }; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPngInfo = exports.compositeImagesAsync = exports.Cache = exports.generateFaviconAsync = exports.generateImageAsync = exports.sharpAsync = exports.isAvailableAsync = exports.findSharpInstanceAsync = exports.jimpAsync = exports.imageAsync = void 0; | ||
exports.getPngInfo = exports.compositeImagesAsync = exports.Cache = exports.generateFaviconAsync = exports.generateImageAsync = exports.sharpAsync = exports.isAvailableAsync = exports.findSharpInstanceAsync = exports.createSquareAsync = exports.jimpAsync = exports.imageAsync = void 0; | ||
const Cache = __importStar(require("./Cache")); | ||
@@ -37,2 +37,3 @@ exports.Cache = Cache; | ||
Object.defineProperty(exports, "jimpAsync", { enumerable: true, get: function () { return jimp_1.jimpAsync; } }); | ||
Object.defineProperty(exports, "createSquareAsync", { enumerable: true, get: function () { return jimp_1.createSquareAsync; } }); | ||
const sharp_1 = require("./sharp"); | ||
@@ -39,0 +40,0 @@ Object.defineProperty(exports, "findSharpInstanceAsync", { enumerable: true, get: function () { return sharp_1.findSharpInstanceAsync; } }); |
@@ -13,4 +13,12 @@ /// <reference types="node" /> | ||
export declare function circleAsync(jimp: Jimp): Promise<Jimp>; | ||
/** | ||
* Create a square image of a given size and color. Defaults to a white PNG. | ||
*/ | ||
export declare function createSquareAsync({ size, color, mime, }: { | ||
size: number; | ||
color?: string; | ||
mime?: any; | ||
}): Promise<Buffer>; | ||
export declare function getJimpImageAsync(input: string | Buffer | Jimp): Promise<Jimp>; | ||
export declare function resize({ input, quality }: JimpGlobalOptions, { background, position, fit, width, height }: Omit<ResizeOptions, 'operation'>): Promise<Jimp>; | ||
export {}; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resize = exports.getJimpImageAsync = exports.circleAsync = exports.isFolderAsync = exports.jimpAsync = exports.convertFormat = exports.resizeBufferAsync = void 0; | ||
exports.resize = exports.getJimpImageAsync = exports.createSquareAsync = exports.circleAsync = exports.isFolderAsync = exports.jimpAsync = exports.convertFormat = exports.resizeBufferAsync = void 0; | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
@@ -121,2 +121,11 @@ // @ts-ignore | ||
exports.circleAsync = circleAsync; | ||
/** | ||
* Create a square image of a given size and color. Defaults to a white PNG. | ||
*/ | ||
async function createSquareAsync({ size, color = '#FFFFFF', mime = jimp_compact_1.default.MIME_PNG, }) { | ||
const image = await new jimp_compact_1.default(size, size, color); | ||
// Convert Jimp image to a Buffer | ||
return await image.getBufferAsync(mime); | ||
} | ||
exports.createSquareAsync = createSquareAsync; | ||
async function getJimpImageAsync(input) { | ||
@@ -123,0 +132,0 @@ // @ts-ignore: Jimp types are broken |
{ | ||
"name": "@expo/image-utils", | ||
"version": "0.0.1-canary-20240320-8a10e09", | ||
"version": "0.0.1-canary-20240327-a7302d9", | ||
"description": "A package used by Expo CLI for processing images", | ||
@@ -42,3 +42,3 @@ "main": "build/index.js", | ||
"resolve-from": "^5.0.0", | ||
"semver": "7.5.4", | ||
"semver": "^7.6.0", | ||
"tempy": "0.3.0" | ||
@@ -51,3 +51,3 @@ }, | ||
"@types/semver": "^6.0.0", | ||
"expo-module-scripts": "0.0.1-canary-20240320-8a10e09" | ||
"expo-module-scripts": "0.0.1-canary-20240327-a7302d9" | ||
}, | ||
@@ -57,3 +57,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "8a10e09a475b60c4cdf1983e64618ed5fcc8f5ed" | ||
"gitHead": "a7302d9916a445e550bd2a0953f797a914538e77" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
77251
1083
+ Addedsemver@7.7.1(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedsemver@7.5.4(transitive)
- Removedyallist@4.0.0(transitive)
Updatedsemver@^7.6.0