Skip to content

Commit 8d4c70d

Browse files
committed
docs: improve notes structure
1 parent 1d44870 commit 8d4c70d

File tree

1 file changed

+146
-48
lines changed

1 file changed

+146
-48
lines changed

β€Žblog/release.md

Lines changed: 146 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,49 @@
11
---
22
slug: Release of a new version
33
title: Release Notes
4-
date: 2024-01-15
5-
authors: [maxim]
6-
tags: [release]
4+
date: 2025-07-19
5+
tags: [release, v1, image-js]
76
---
87

9-
We're excited to announce the release of image-js-typescript, a complete rewrite of the popular image-js library. This new version brings modern TypeScript support and a more intuitive API while maintaining the powerful image processing capabilities you love.
8+
We're excited to announce the release of image-js-typescript, a complete rewrite of the popular image-js library. This new version brings TypeScript support and a more intuitive API while maintaining the powerful image processing capabilities you love.
109

11-
## ⚠️ API Changes
10+
<!--- truncate --->
1211

13-
### Stricter typing
12+
# API Changes
1413

15-
```js
16-
// Before
17-
const pixel = img.getPixel(x, y); // any[]
18-
19-
// After
20-
const pixel = img.getPixel(x, y); // number[] with proper typing
21-
```
14+
## ⚠️ Breaking changes
2215

2316
### Changed the way images are loaded and created
2417

25-
Static method `load` for reading and writing images has been replaced with dedicated functions `read` and `write`. There are also synchronous versions of these functions.(add more explanation)
18+
Static method `load` for reading and method `save` for writing images have been replaced with dedicated functions `read` and `write`.
2619

2720
```ts
28-
javascript; // Before
21+
//Before
2922
import { Image } from 'image-js';
3023
const img = await Image.load('cat.jpg');
24+
img.save('newCat.jpg');
3125
```
3226

3327
```ts
34-
// After
35-
import { readSync, read } from 'image-js';
28+
//After
29+
import { read, write } from 'image-js';
30+
const img2 = await read('cat.jpg');
31+
await write('newCat.jpg', img);
32+
```
33+
34+
There are also synchronous versions of these functions.(add more explanation)
35+
36+
```ts
37+
import { readSync, writeSync } from 'image-js';
3638
const img = readSync('cat.jpg');
37-
// or
38-
const img = await read('cat.jpg');
39+
writeSync('newCat.jpg', img);
3940
```
4041

42+
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.
43+
4144
### Distinction between Image and Mask objects
4245

43-
In the new version of ImageJS binary images(masks) becomes a separate class.
46+
Binary images are now handled by a dedicated Mask class instead of Image with `kind: 'BINARY'`.
4447

4548
```ts
4649
// Before
@@ -52,51 +55,146 @@ const mask = new Image(10, 10, { kind: 'BINARY' });
5255
const mask = new Mask(10, 10);
5356
```
5457

55-
In previous versions binary images (masks) had 8 pixels of data stacked in one byte.The new version changes that. Now Masks' data reserves 1 byte per pixel.
56-
It improves and facilitates data readability and editing.
58+
Dedicated Mask class provides better type safety, clearer API, and optimized performance for binary operations.
59+
60+
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.
61+
62+
### Modification of Sobel and Scharr filters
63+
64+
[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.
65+
66+
```ts
67+
// Before
68+
const sobelX = img.sobelX();
69+
const sobelY = img.sobelY();
70+
71+
// After
72+
const sobelX = img.derivative({ filter: 'sobel' });
73+
const sobelY = img.derivative({ filter: 'scharr' });
74+
```
75+
76+
This filter also now accepts only grayscale images, since filters like sobel or scharr are used mainly on grayscale images to detect edges.
77+
78+
### Enhanced TypeScript Support
79+
80+
All APIs now have strict TypeScript definitions:
81+
82+
```ts
83+
ts; // Before: loose typing
84+
const pixel = img.getPixel(x, y); // any[]
85+
86+
// After: strict typing
87+
const pixel = img.getPixel(x, y); // number[] with proper channel count
88+
```
89+
90+
### Method Renaming
91+
92+
Several methods have been renamed for consistency:
93+
94+
**Drawing methods**:
95+
96+
img.paintPolyline() β†’ img.drawPolyline()
97+
img.paintPolygon() β†’ img.drawPolygon()
98+
img.paintCircle() β†’ img.drawCircle()
99+
100+
**Other methods**:
57101

58-
### New features
102+
img.copy() β†’ img.clone()
103+
img.clearBit() β†’ img.setBit()
104+
img.getLocalMaxima() β†’ img.getExtrema()
105+
img.getChannel() β†’ img.extractChannel()
59106

60-
- Bicubic interpolation has been added as interpolation option
61-
- Canny Edge Detector filter has been added
62-
- `transform` function now accepts 3x3 matrices as well as 2x3
63-
- `warpingFourPoints` function has been deprecated and now `getPerspectiveWarp` returns a matrix that can be used in a new `transform()` function.
107+
Consistent naming follows common conventions (draw\* for rendering, clone for copying objects).
64108

65-
### Refactored functions
109+
## πŸ†• New Features
110+
111+
### `transform()` function
112+
113+
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.
114+
115+
```ts
116+
const matrix = getPerspectiveWarp(sourcePoints);
117+
const warped = img.transform(matrix);
118+
```
119+
120+
For more details visit our [tutorial](../docs/Tutorials/Applying%20transform%20function%20on%20images) on how image transformations work.
121+
122+
### Bicubic Interpolation
123+
124+
High-quality image scaling is now available with [bicubic interpolation](https://en.wikipedia.org/wiki/Bicubic_interpolation):
125+
126+
```ts
127+
const resized = img.resize(800, 600, { interpolation: 'bicubic' });
128+
```
129+
130+
**Use case**: Better quality when upscaling images, especially for photographs.
131+
132+
### Canny Edge Detection
133+
134+
[Canny Edge Detector](../docs/Features/Morphology/Canny%20Edge%20Detector) is an advanced edge detection filter for computer vision applications:
135+
136+
```ts
137+
const edges = img.cannyEdgeDetector({
138+
lowThreshold: 50,
139+
highThreshold: 150,
140+
});
141+
```
142+
143+
**Use case**: Object detection, image segmentation, feature extraction. You can learn more about it [here](../docs/Features/Morphology/Canny%20Edge%20Detector.md).
144+
145+
### Prewitt filter
146+
147+
[Prewitt](https://en.wikipedia.org/wiki/Prewitt_operator) filter has been added to the `derivative()` filter.
148+
149+
```ts
150+
const prewitt = img.derivative({ filter: 'prewitt' });
151+
```
152+
153+
**Use case**: Object detection, image segmentation, feature extraction. You can learn more about it [here](../docs/Features/Morphology/Morphological%20Gradient).
154+
155+
### Migration from deprecated methods:
156+
157+
`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.
158+
159+
```ts
160+
// Before
161+
const warped = img.warpingFourPoints(corners);
162+
163+
// After
164+
const matrix = getPerspectiveWarp(corners);
165+
const warped = img.transform(matrix);
166+
```
66167

67-
Several methods have been renamed. Some notable changes:
168+
**Use case**: Rectification of a perspective angle of an image. You can learn more about it [here](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix).
68169

69-
- `paint*` methods(`drawPoligon()`, `paintPolyline()` etc.) are now `draw\*` methods(`drawPolyline()`,`drawPoligon()` etc.).
70-
- `copy()` β†’ `clone()`
71-
- `clearBit()` β†’ `setBit()`,`setBitByPoint()`,`setBitByCoord()`
72-
- `getLocalMaxima` β†’ `getExtrema`
73-
- `getChannel()`β†’`extractChannel()`
170+
# πŸ—‘οΈ Removed Features
74171

75-
### Bug fixes
172+
The following deprecated features have been removed:
76173

77-
- Fixed perspectiveWarp functioning
174+
- `countAlphaPixel()` - Use custom pixel counting with getPixel()
175+
- `paintLabels()` - Feature was removed due to poor performance.
176+
- `warpingFourPoints()` - Use `getPerspectiveWarp()` + `transform()`.
78177

79-
### Removed Features
178+
# πŸ”§ Compatibility & Requirements
80179

81-
- `countAlphaPixel` was removed.
82-
- `paintLabels` was removed.
180+
- Node.js: 16+ (previously 14+)
181+
- TypeScript: 4.5+ (if using TypeScript)
83182

84-
### Configuration Changes
183+
# πŸš€ Getting Started
85184

86-
Default parameters: Some filter defaults have changed for better results
87-
Color space handling: Improved but different color space conversion behavior
185+
To get started with ImageJS, we recommend visiting our ["Get started"](../docs/Getting%20started) guide
88186

89-
## πŸ“š Resources
187+
# πŸ“š Resources
90188

91-
[API Documentation](https://image-js.github.io/image-js-typescript/)
92-
[Examples and Tutorials](https://image-js-docs.pages.dev/)
93-
[GitHub Repository](https://github.com/image-js/image-js-typescript)
189+
- [API Documentation](https://image-js.github.io/image-js-typescript/)
190+
- [Examples and Tutorials](https://image-js-docs.pages.dev/)
191+
- [GitHub Repository](https://github.com/image-js/image-js-typescript)
94192

95-
## 🀝 Contributing
193+
# 🀝 Contributing
96194

97195
We welcome contributions! The new TypeScript codebase makes it easier than ever to contribute. Check out our contributing guide to get started.
98196

99-
## πŸ™ Acknowledgments
197+
# πŸ™ Acknowledgments
100198

101199
Special thanks to all contributors who made this release possible and to the community for their feedback and support during the development process.
102200

0 commit comments

Comments
Β (0)