-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmod.ts
More file actions
92 lines (90 loc) · 2.92 KB
/
mod.ts
File metadata and controls
92 lines (90 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* @module @cross/image
*
* A pure JavaScript, dependency-free, cross-runtime image processing library.
* Supports decoding, resizing, and encoding common image formats (PNG, APNG, JPEG, WebP, GIF, TIFF, BMP, ICO, DNG, PAM, PPM, PGM, PBM, PCX, QOI).
* Includes image processing capabilities like compositing, level adjustments, and pixel manipulation.
*
* @example
* ```ts
* import { Image } from "jsr:@cross/image";
*
* // Decode an image
* const data = await Deno.readFile("input.png");
* const image = await Image.decode(data);
*
* // Apply image processing
* image
* .resize({ width: 200, height: 200 })
* .brightness(0.1)
* .contrast(0.2);
*
* // Encode as different format
* const output = await image.encode("jpeg");
* await Deno.writeFile("output.jpg", output);
* ```
*
* @example
* ```ts
* import { Image } from "jsr:@cross/image";
*
* // Create a blank canvas
* const canvas = Image.create(400, 300, 255, 255, 255);
*
* // Draw on it
* canvas.fillRect(50, 50, 100, 100, 255, 0, 0, 255);
*
* // Load and composite another image
* const overlay = await Image.decode(await Deno.readFile("logo.png"));
* canvas.composite(overlay, 10, 10, 0.8);
*
* // Save the result
* await Deno.writeFile("result.png", await canvas.encode("png"));
* ```
*/
export { Image } from "./src/image.ts";
export type {
/* Encoder options */
APNGEncoderOptions,
ASCIIEncoderOptions,
AVIFEncoderOptions,
/* Coefficient types for steganography */
CoefficientData,
FrameMetadata,
GIFEncoderOptions,
HEICEncoderOptions,
ImageData,
/* Decoder options */
ImageDecoderOptions,
ImageFormat,
ImageFrame,
ImageMetadata,
JPEGComponentCoefficients,
JPEGEncoderOptions,
JPEGQuantizedCoefficients,
MultiFrameImageData,
PNGEncoderOptions,
ResizeOptions,
TIFFEncoderOptions,
WebPEncoderOptions,
} from "./src/types.ts";
export { PNGFormat } from "./src/formats/png.ts";
export { APNGFormat } from "./src/formats/apng.ts";
export { JPEGFormat } from "./src/formats/jpeg.ts";
export { WebPFormat } from "./src/formats/webp.ts";
export { GIFFormat } from "./src/formats/gif.ts";
export { TIFFFormat } from "./src/formats/tiff.ts";
export { BMPFormat } from "./src/formats/bmp.ts";
export { ICOFormat } from "./src/formats/ico.ts";
export { DNGFormat } from "./src/formats/dng.ts";
export { PAMFormat } from "./src/formats/pam.ts";
export { PCXFormat } from "./src/formats/pcx.ts";
export { PPMFormat } from "./src/formats/ppm.ts";
export { PGMFormat } from "./src/formats/pgm.ts";
export { PBMFormat } from "./src/formats/pbm.ts";
export { QOIFormat } from "./src/formats/qoi.ts";
export { ASCIIFormat } from "./src/formats/ascii.ts";
export { HEICFormat } from "./src/formats/heic.ts";
export { AVIFFormat } from "./src/formats/avif.ts";
export { decodeBase64, encodeBase64, parseDataUrl, toDataUrl } from "./src/utils/base64.ts";
export { cmykToRgb, cmykToRgba, rgbaToCmyk, rgbToCmyk } from "./src/utils/image_processing.ts";