@rajeev02/camera 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# @rajeev02/camera
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@rajeev02/camera)
|
|
4
|
+
[](https://github.com/Rajeev02/rajeev-sdk/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
**Camera capture & photo editor** with HDR, 9 capture modes, 24 built-in filters, and a full editing suite — crop, adjust, text, stickers, drawing, and beauty mode.
|
|
7
|
+
|
|
8
|
+
Part of [Rajeev SDK](https://github.com/Rajeev02/rajeev-sdk) — cross-platform infrastructure libraries for building apps that work everywhere.
|
|
9
|
+
|
|
10
|
+
## Why use this?
|
|
11
|
+
|
|
12
|
+
- **9 capture modes** — Photo, video, portrait, night, panorama, slow-mo, time-lapse, burst, document scan
|
|
13
|
+
- **24 built-in filters** — Categorized: Natural, Warm, Cool, B&W, Cinematic, Vintage — with real-time preview
|
|
14
|
+
- **Full photo editor** — Crop (free/square/16:9/4:3), adjust (brightness, contrast, saturation, etc.), rotate, flip
|
|
15
|
+
- **Text & stickers** — Add text overlays with fonts, colors, alignment. Add sticker packs.
|
|
16
|
+
- **Beauty mode** — Skin smoothing, face brightening, eye enhancement — subtle defaults
|
|
17
|
+
- **HDR & zoom** — Hardware HDR, digital zoom up to 10x, front/back camera switching
|
|
18
|
+
- **Event-driven** — Subscribe to capture events, recording progress, focus changes
|
|
19
|
+
|
|
20
|
+
## Platform Support
|
|
21
|
+
|
|
22
|
+
| Platform | Engine | Status |
|
|
23
|
+
| ---------- | ---------- | ------ |
|
|
24
|
+
| iOS 16+ | TypeScript | ✅ |
|
|
25
|
+
| Android 7+ | TypeScript | ✅ |
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @rajeev02/camera
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Peer Dependencies
|
|
34
|
+
|
|
35
|
+
- `react` >= 18.3.0
|
|
36
|
+
- `react-native` >= 0.84.0 _(optional)_
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Camera Capture
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { CameraController } from "@rajeev02/camera";
|
|
44
|
+
|
|
45
|
+
const camera = new CameraController({
|
|
46
|
+
facing: "back",
|
|
47
|
+
flash: "auto",
|
|
48
|
+
mode: "photo",
|
|
49
|
+
hdr: true,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Listen for capture events
|
|
53
|
+
camera.on((event) => {
|
|
54
|
+
if (event.type === "media_captured") {
|
|
55
|
+
console.log("Photo saved:", event.media.uri);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Switch to portrait mode and capture
|
|
60
|
+
camera.setMode("portrait");
|
|
61
|
+
camera.setZoom(1.5);
|
|
62
|
+
camera.capturePhoto();
|
|
63
|
+
|
|
64
|
+
// Video recording
|
|
65
|
+
camera.setMode("video");
|
|
66
|
+
camera.startRecording();
|
|
67
|
+
// ... later
|
|
68
|
+
camera.stopRecording(); // → triggers "recording_stopped" event
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Photo Editor
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { PhotoEditorController, getBuiltInFilters } from "@rajeev02/camera";
|
|
75
|
+
|
|
76
|
+
const editor = new PhotoEditorController("file:///photo.jpg");
|
|
77
|
+
|
|
78
|
+
// Apply a filter
|
|
79
|
+
editor.applyFilter("golden_hour");
|
|
80
|
+
|
|
81
|
+
// Adjust
|
|
82
|
+
editor.setAdjustment("brightness", 15);
|
|
83
|
+
editor.setAdjustment("contrast", 10);
|
|
84
|
+
editor.setAdjustment("saturation", -5);
|
|
85
|
+
|
|
86
|
+
// Crop to 16:9
|
|
87
|
+
editor.setCropAspectRatio("16:9");
|
|
88
|
+
|
|
89
|
+
// Add text overlay
|
|
90
|
+
editor.addText({
|
|
91
|
+
text: "Summer 2026 ☀️",
|
|
92
|
+
fontFamily: "Helvetica",
|
|
93
|
+
fontSize: 24,
|
|
94
|
+
color: "#FFFFFF",
|
|
95
|
+
bold: true,
|
|
96
|
+
alignment: "center",
|
|
97
|
+
position: { x: 0.5, y: 0.9 },
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Get edit state for export
|
|
101
|
+
const state = editor.getEditState();
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Filters
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { getBuiltInFilters, getFiltersByCategory } from "@rajeev02/camera";
|
|
108
|
+
|
|
109
|
+
const allFilters = getBuiltInFilters(); // 24 filters
|
|
110
|
+
const warmFilters = getFiltersByCategory("warm");
|
|
111
|
+
// → ["golden_hour", "sunset_glow", "amber", "warm_vintage"]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Available Filters
|
|
115
|
+
|
|
116
|
+
| Category | Filters |
|
|
117
|
+
| --------- | ---------------------------------------------- |
|
|
118
|
+
| Natural | vivid, soft_light, clarity, natural_hdr |
|
|
119
|
+
| Warm | golden_hour, sunset_glow, amber, warm_vintage |
|
|
120
|
+
| Cool | arctic, ocean_blue, moonlight, cool_breeze |
|
|
121
|
+
| B&W | noir, silver, high_contrast_bw, film_grain |
|
|
122
|
+
| Cinematic | teal_orange, blockbuster, moody, anamorphic |
|
|
123
|
+
| Vintage | polaroid, retro_80s, faded_film, cross_process |
|
|
124
|
+
|
|
125
|
+
## API Reference
|
|
126
|
+
|
|
127
|
+
### `CameraController`
|
|
128
|
+
|
|
129
|
+
| Method | Description |
|
|
130
|
+
| ------------------ | --------------------- |
|
|
131
|
+
| `capturePhoto()` | Capture a photo |
|
|
132
|
+
| `startRecording()` | Start video recording |
|
|
133
|
+
| `stopRecording()` | Stop video recording |
|
|
134
|
+
| `setMode(mode)` | Set capture mode |
|
|
135
|
+
| `setFlash(mode)` | Set flash mode |
|
|
136
|
+
| `setZoom(level)` | Set zoom level |
|
|
137
|
+
| `flipCamera()` | Toggle front/back |
|
|
138
|
+
| `on(callback)` | Subscribe to events |
|
|
139
|
+
|
|
140
|
+
### `PhotoEditorController`
|
|
141
|
+
|
|
142
|
+
| Method | Description |
|
|
143
|
+
| ---------------------------- | ------------------------------- |
|
|
144
|
+
| `applyFilter(id)` | Apply a filter preset |
|
|
145
|
+
| `setAdjustment(type, value)` | Adjust brightness/contrast/etc. |
|
|
146
|
+
| `setCropAspectRatio(ratio)` | Set crop ratio |
|
|
147
|
+
| `addText(config)` | Add text overlay |
|
|
148
|
+
| `addSticker(config)` | Add sticker |
|
|
149
|
+
| `rotate(degrees)` | Rotate image |
|
|
150
|
+
| `flip(axis)` | Flip horizontal/vertical |
|
|
151
|
+
| `undo()` / `redo()` | Undo/redo edits |
|
|
152
|
+
| `getEditState()` | Get full edit state |
|
|
153
|
+
|
|
154
|
+
## Full Documentation
|
|
155
|
+
|
|
156
|
+
📖 [Complete API docs with all modes, filters, and editor features](https://github.com/Rajeev02/rajeev-sdk/blob/main/docs/usage/CAMERA.md)
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT © 2026 [Rajeev Kumar Joshi](https://rajeev02.github.io)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rajeev02/camera",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Advanced camera capture & photo editing — filters, crop, adjust, stickers, text, drawing, beauty mode, HDR, panorama",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Rajeev Kumar Joshi <rajeevjoshi91@gmail.com> (https://rajeev02.github.io)",
|