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
Copy file name to clipboardExpand all lines: blog/release.md
+61-46Lines changed: 61 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
slug: Release of a new version
3
-
title: Release Notes
2
+
slug: v1-release
3
+
title: Release notes v1
4
4
date: 2025-07-19
5
5
---
6
6
@@ -10,11 +10,25 @@ We're excited to announce the release of a new major version of ImageJS. This ve
10
10
11
11
# API Changes
12
12
13
+
## 🔷 TypeScript Support
14
+
15
+
All APIs now have strict TypeScript definitions:
16
+
17
+
```ts
18
+
// Before: loose typing
19
+
const pixel =img.getPixel(x, y); // any[]
20
+
21
+
// After: strict typing
22
+
const pixel =img.getPixel(x, y); // number[] with proper channel count
23
+
```
24
+
25
+
This eliminates runtime type errors and provides better IntelliSense, autocomplete, and refactoring support in your IDE. Developers can now catch bugs at compile time rather than discovering them in production.
26
+
13
27
## ⚠️ Breaking changes
14
28
15
-
### Changes in the way images are loaded and created
29
+
### Loading and saving images
16
30
17
-
Static method `load()`for reading and method `save()` for writing images have been replaced with dedicated functions `read()` and `write()`.
31
+
`load()` and `save()` have been replaced with dedicated functions `read()` and `write()`.
18
32
19
33
```ts
20
34
//Before
@@ -40,9 +54,24 @@ writeSync('newCat.jpg', img);
40
54
41
55
The new approach allows for better TypeScript inference, smaller bundle sizes through tree-shaking, and clearer API design where I/O operations are separate from image manipulation.
42
56
43
-
### Distinction between Image and Mask objects
57
+
### Creating images
58
+
59
+
When creating a new image, unlike before, image's width and height must be specified.
60
+
61
+
```ts
62
+
import { Image } from'image-js';
63
+
64
+
// Would work before, will throw an error in a new version.
65
+
const image =newImage();
66
+
// Works fine.
67
+
const image2 =newImage(10, 10);
68
+
```
44
69
45
-
Binary images are now handled by a dedicated Mask class instead of Image with `kind: 'BINARY'`.
70
+
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
71
+
72
+
### Masks
73
+
74
+
Binary images are now handled by a dedicated `Mask` class instead of Image with `kind: 'BINARY'`.
Dedicated `Mask` class provides better type safety, clearer API, and optimized performance for binary operations.
86
+
`Mask` provides better type safety, clearer API, and optimized performance for binary operations.
58
87
59
88
The new `Mask` class uses 1 byte per pixel (vs 8 pixels per byte), trading ~8x memory usage for significantly faster bit operations and simpler data manipulation.
60
89
61
-
### Modification of Sobel and Scharr filters
90
+
### Sobel and Scharr filters
62
91
63
-
[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.
92
+
[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.
This filter now also accepts only grayscale images, since filters,like Sobel or Scharr, are used mainly on grayscale images to detect edges.
76
-
77
-
### Enhanced TypeScript Support
78
-
79
-
All APIs now have strict TypeScript definitions:
80
-
81
-
```ts
82
-
ts; // Before: loose typing
83
-
const pixel =img.getPixel(x, y); // any[]
84
-
85
-
// After: strict typing
86
-
const pixel =img.getPixel(x, y); // number[] with proper channel count
87
-
```
88
-
89
-
This eliminates runtime type errors and provides better IntelliSense, autocomplete, and refactoring support in your IDE. Developers can now catch bugs at compile time rather than discovering them in production.
104
+
This filter now also accepts only grayscale images, since filters, like Sobel or Scharr, are used mainly on grayscale images to detect edges.
90
105
91
106
### Method Renaming
92
107
@@ -110,20 +125,34 @@ Several methods have been renamed for consistency:
110
125
111
126
`img.getChannel()` ➡️ `img.extractChannel()`
112
127
113
-
Consistent naming follows common conventions (draw\* for rendering, clone for copying objects).
128
+
Consistent naming follows common conventions ("draw\*" for rendering, "clone" for copying objects).
129
+
130
+
### Compatibility requirements
131
+
132
+
- Node.js: 18+ (previously 14+)
133
+
- TypeScript: 5.2.2+ (if using TypeScript)
134
+
135
+
### Removed Features
136
+
137
+
The following deprecated features have been removed:
138
+
139
+
-`countAlphaPixel()` - Use custom pixel counting with `getPixel()`
140
+
-`paintLabels()` - Feature was removed due to dependency issues. We plan to add it back in the future updates.
141
+
-`warpingFourPoints()` - Use `getPerspectiveWarp()` + `transform()`.
142
+
- 32-bit color depth has been currently deprecated. We plan to add it back in the future updates as well.
114
143
115
144
## 🆕 New Features
116
145
117
-
### `transform()` function
146
+
### `transform()`
118
147
119
-
The `transform()`function allows applying transformation matrix on the image. Which means that the image can now be translated or sheared or warped based on the matrix that the user entered. `transform()` function accepts both 2x3 and 3x3 matrices, depending on whether you want an affine transformation or a perspective one.
148
+
`transform()` allows applying a transformation matrix on the image. Which means that the image can now be translated, sheared, or warped based on the matrix that the user entered. `transform()` accepts both 2x3 and 3x3 matrices, depending on whether you want an affine transformation or a perspective one.
120
149
121
150
```ts
122
151
const matrix =getPerspectiveWarp(sourcePoints);
123
152
const warped =img.transform(matrix);
124
153
```
125
154
126
-
For more details visit our [tutorial](/docs/Tutorials/Applying%20transform%20function%20on%20images) on how image transformations work.
155
+
For more details, visit our [tutorial](/docs/Tutorials/Applying%20transform%20function%20on%20images) on how image transformations work.
**Use case**: Object detection, image segmentation, feature extraction. You can learn more about it [here](../docs/Features/Morphology/Morphological%20Gradient).
160
189
161
-
### Migration from deprecated methods:
190
+
### Migration from deprecated methods
162
191
163
-
`warpingFourPoints()`function has been deprecated. Now you have [`getPerspectiveWarp()`](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix)function that returns a matrix that can be applied on an image of interest in a new `transform()` function.
192
+
`warpingFourPoints()` has been deprecated. Now you have [`getPerspectiveWarp()`](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix) that returns a matrix that can be applied on the image of interest in a new `transform()`.
**Use case**: Rectification of a perspective angle of an image. You can learn more about it [here](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix).
175
204
176
-
## 🗑️ Removed Features
177
-
178
-
The following deprecated features have been removed:
179
-
180
-
-`countAlphaPixel()` - Use custom pixel counting with `getPixel()`
181
-
-`paintLabels()` - Feature was removed due to dependency issues. We plan to add it back in the future updates.
182
-
-`warpingFourPoints()` - Use `getPerspectiveWarp()` + `transform()`.
183
-
- 32-bit color depth has been currently deprecated. We plan to add it back in the future updates as well.
184
-
185
-
## 🔧 Compatibility & Requirements
186
-
187
-
- Node.js: 18+ (previously 14+)
188
-
- TypeScript: 5.2.2+ (if using TypeScript)
189
-
190
205
## 🚀 Getting Started
191
206
192
-
To get started with ImageJS, we recommend visiting our [\"Get started\"](../docs/Getting%20started) guide
207
+
To get started with ImageJS, we recommend visiting our ["Get started"](../docs/Getting%20started) guide
0 commit comments