You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're excited to announce the release of a new major version of ImageJS. This version brings TypeScript support and a more intuitive API while maintaining the powerful image processing capabilities you love.
@@ -71,9 +71,26 @@ const image2 = new Image(10, 10);
71
71
72
72
This change makes the Image constructor more explicit by requiring you to specify the dimensions upfront, preventing potential errors from working with uninitialized or undefined-sized images
73
73
74
-
#### Image position
74
+
#### Coordinate System Changes
75
75
76
-
Images now include an `origin` property that tracks their position relative to their parent image. When you crop an image, the cropped section remembers where it came from in the original image.
76
+
Coordinates are now represented using `Point` objects instead of arrays. This change affects methods that require coordinate input like cropping, drawing, and pixel manipulation.
77
+
78
+
```ts
79
+
// Before
80
+
const croppedImage =img.crop({
81
+
origin: [10, 10],
82
+
width: 10,
83
+
height: 10,
84
+
});
85
+
// After
86
+
const croppedImage =img.crop({
87
+
origin: { column: 10, row: 10 },
88
+
width: 10,
89
+
height: 10,
90
+
});
91
+
```
92
+
93
+
Images also include an `origin` that tracks their position relative to their parent image. When you crop an image, the cropped section remembers where it came from in the original image.
It is a more explicit and self-documenting code.It also eliminates confusion about array order (column vs row).
106
+
88
107
### Masks
89
108
90
109
Binary images are now handled by a dedicated `Mask` class instead of Image with `kind: 'BINARY'`.
@@ -105,25 +124,6 @@ The new `Mask` class uses 1 byte per pixel (vs 8 pixels per byte), trading ~8x m
105
124
106
125
### Points
107
126
108
-
Coordinates are now represented using `Point` objects instead of arrays. This change affects methods that require coordinate input like cropping, drawing, and pixel manipulation.
109
-
110
-
```ts
111
-
// Before
112
-
const croppedImage =img.crop({
113
-
origin: [10, 10],
114
-
width: 10,
115
-
height: 10,
116
-
});
117
-
// After
118
-
const croppedImage =img.crop({
119
-
origin: { column: 10, row: 10 },
120
-
width: 10,
121
-
height: 10,
122
-
});
123
-
```
124
-
125
-
It is a more explicit and self-documenting code and it also eliminates confusion about array order (column vs row).
126
-
127
127
### Sobel and Scharr filters
128
128
129
129
[Sobel](https://en.wikipedia.org/wiki/Sobel_operator), [Scharr](https://en.wikipedia.org/wiki/Sobel_operator#Alternative_operators) filters are now combined into a single `derivative()` method.
@@ -152,19 +152,29 @@ Several methods have been renamed for consistency:
152
152
153
153
`img.paintCircle()` ➡️ `img.drawCircle()`
154
154
155
-
**Other methods**:
155
+
**Stack methods**
156
156
157
-
`img.copy()` ➡️ `img.clone()`
157
+
`stack.getMinImage()` ➡️ `stack.minImage()`
158
+
159
+
`stack.getMinImage()` ➡️ `stack.maxImage()`
160
+
161
+
`stack.getAverageImage()` ➡️ `stack.meanImage()`
162
+
163
+
**Other methods**:
158
164
159
165
`img.clearBit()` ➡️ `img.setBit()`
160
166
161
167
`img.getLocalMaxima()` ➡️ `img.getExtrema()`
162
168
163
169
`img.getChannel()` ➡️ `img.extractChannel()`
164
170
165
-
`img.rotateLeft()` and `img.rotateRight()` ➡️ `img.rotate()`
0 commit comments