Skip to content

Commit 88543a4

Browse files
committed
docs: resolve conversations
1 parent 64578d9 commit 88543a4

File tree

1 file changed

+92
-87
lines changed

1 file changed

+92
-87
lines changed

β€Žblog/release.md

Lines changed: 92 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const img = readSync('cat.jpg');
5454
writeSync('newCat.jpg', img);
5555
```
5656

57-
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.
57+
Those changes separates I/O operations from image manipulation for a clearer API design.
5858

5959
#### Creating
6060

@@ -63,13 +63,13 @@ When creating a new image, unlike before, image's width and height must be speci
6363
```ts
6464
import { Image } from 'image-js';
6565

66-
// Would work before, will throw an error in a new version.
66+
// Would work before, will throw an error in the new version.
6767
const image = new Image();
6868
// Works fine.
6969
const image2 = new Image(10, 10);
7070
```
7171

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
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.
7373

7474
#### Coordinate System Changes
7575

@@ -107,7 +107,7 @@ const mask = new Image(10, 10, { kind: 'BINARY' });
107107
const mask = new Mask(10, 10);
108108
```
109109

110-
`Mask` provides better type safety, clearer API, and optimized performance for binary operations.
110+
`Mask` provides better type safety and clearer API.
111111

112112
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.
113113

@@ -168,6 +168,8 @@ Several methods have been renamed for consistency:
168168

169169
`img.paintCircle()` ➑️ `img.drawCircle()`
170170

171+
`img.paintPoints()` ➑️ `img.drawMarkers()`
172+
171173
**Stack methods**
172174

173175
`stack.getMinImage()` ➑️ `stack.minImage()`
@@ -226,33 +228,37 @@ Several methods have been renamed for consistency:
226228

227229
`img.getBestMatch()` ➑️ `alignMinDifference()`
228230

231+
`img.pad()` ➑️ `img.extendBorder()`
232+
233+
`img.minimalBoundingRectangle()` ➑️ `mask.getMbr()`
234+
235+
`img.monotoneChainConvexHull()` ➑️ `mask.getConvexHull()`
236+
229237
### Compatibility requirements
230238

231239
- Node.js: 18+ (previously 14+)
232-
- TypeScript: 5.2.2+ (if using TypeScript)
233240

234241
### Removed Features
235242

236243
The following deprecated features have been removed:
237244

238245
#### Images
239246

240-
- `countAlphaPixel()` - Use custom pixel counting with `getPixel()`
241-
- `paintLabels()` and `roi.paint()` - Features have been removed due to dependency issues. We plan to add it back in the future updates.
242-
- `warpingFourPoints()` - Use `getPerspectiveWarp()` + `transform()`.
243-
- 32-bit color depth has been currently removed. We plan to add it back in the future updates as well.
247+
- `countAlphaPixel()` - Use custom pixel counting with [`getPixel()`](https://image-js.github.io/image-js/classes/index.Image.html#getpixel 'API link on getPixel').
248+
- `paintLabels()` and `roi.paint()` - Features have been removed due to dependency issues. We plan to add it back in future updates.
249+
- `warpingFourPoints()` - Use [`getPerspectiveWarpMatrix()`](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix 'internal link on getPerspectiveWarp') + [`transform()`](release.md#transform) instead.
250+
- 32-bit color depth support and `abs()` have been removed.
244251
- `CMYK` and `HSL` color models have been removed.
245-
- `abs()` has been removed.
246-
- `paintMasks()` has been removed. Use `paintMask()`+ `for` loop.
252+
- `paintMasks()` has been removed. Use [`paintMask()`](https://image-js.github.io/image-js/classes/index.Image.html#paintmask 'API link on paintMask')+ a `for` loop.
247253
- `clearBit()` and `toggleBit()` have been removed, due to changes in `Mask`
248-
data representation (see ["Masks"](#masks)).
254+
data representation (see ["Masks"](#masks)). Use [`setBit()`](https://image-js.github.io/image-js/classes/index.Mask.html#setbit 'API link on setBit') or [`setValue()`](https://image-js.github.io/image-js/classes/index.Image.html#setvalue 'API link on setValue') instead.
249255
- `combineChannels()` has been removed.
250-
- `rgba8()` and `rgba()` have been removed. Use combination of `convertColorModel()` and `convertBitDepth()`.
251-
- `getRelativePosition()` has been removed.
256+
- `rgba8()` and `rgba()` have been removed. Use a combination of [`convertColor()`](https://image-js.github.io/image-js/classes/index.Image.html#convertcolor 'API link on convertColor') and [`convertBitDepth()`](https://image-js.github.io/image-js/classes/index.Image.html#convertbitdepth 'API link on convertBitDepth') instead.
252257
- `histograms()` and `colorHistogram()` have been removed.
253258
- `getPixelGrid()` has been removed.
254-
- `getClosestCommonParent()` has been removed.
259+
- `getClosestCommonParent()` and `getRelativePosition()` have been removed.
255260
- `getSimilarity()` and `getIntersection()` have been removed.
261+
- `paintPolygons()` and `paintPolylines()`have been removed. Use [`drawPolygon()`](https://image-js.github.io/image-js/classes/index.Image.html#drawpolygon 'API link on drawPolygon')/ [`drawPolyline()`](https://image-js.github.io/image-js/classes/index.Image.html#drawpolyline 'API link on drawPolyline') + a `for` loop.
256262

257263
#### ROIs and its management
258264

@@ -263,16 +269,7 @@ The following deprecated features have been removed:
263269
- `findCorrespondingRoi()` has been removed.
264270
- `resetPainted()` has been removed.
265271
- `mergeRoi()` and `mergeRois()` have been removed.
266-
- `minX`,`minY`,`meanX`,`meanY`,`maxX`,`maxY` have been removed. Use ROI's `position`, combined with its `width` and `height`.
267-
268-
## πŸš€ Performance fixes
269-
270-
Performance of multiple functions has been improved:
271-
272-
- `cannyEdgeDetector()`:
273-
- `resize()`
274-
- `transform()`
275-
- `drawCircle()`
272+
- `minX`,`minY`,`meanX`,`meanY`,`maxX`,`maxY` have been removed. Use [ROI's `position`, combined with its `width` and `height`](https://image-js.github.io/image-js/classes/index.Roi.html 'API link on ROI').
276273

277274
## πŸ†• New Features
278275

@@ -285,11 +282,11 @@ const matrix = getPerspectiveWarp(sourcePoints);
285282
const warped = img.transform(matrix);
286283
```
287284

288-
For more details, visit our [tutorial](/docs/Tutorials/Applying%20transform%20function%20on%20images) on how image transformations work how they can be used.
285+
For more details, visit our [tutorial](/docs/Tutorials/Applying%20transform%20function%20on%20images 'internal link on transform function tutorial') on how image transformations work how they can be used.
289286

290287
### Bicubic Interpolation
291288

292-
High-quality image scaling is now available with [bicubic interpolation](https://en.wikipedia.org/wiki/Bicubic_interpolation):
289+
High-quality image scaling is now available with [bicubic interpolation](https://en.wikipedia.org/wiki/Bicubic_interpolation 'wikipedia link on bicubic interpolation'):
293290

294291
```ts
295292
const resized = img.resize(800, 600, { interpolation: 'bicubic' });
@@ -299,17 +296,17 @@ const resized = img.resize(800, 600, { interpolation: 'bicubic' });
299296

300297
### Prewitt filter
301298

302-
[Prewitt](https://en.wikipedia.org/wiki/Prewitt_operator) filter has been added to the `derivative()` filter.
299+
[Prewitt](https://en.wikipedia.org/wiki/Prewitt_operator 'wikipedia link on prewitt operator') filter has been added to the `derivative()` filter.
303300

304301
```ts
305302
const prewitt = img.derivative({ filter: 'prewitt' });
306303
```
307304

308-
**Use cases**: Object detection, image segmentation, feature extraction. You can learn more about it [here](../docs/Features/Morphology/Morphological%20Gradient).
305+
**Use cases**: Object detection, image segmentation, feature extraction. You can learn more about it [here](../docs/Features/Morphology/Morphological%20Gradient 'internal link on morphological gradient').
309306

310307
### Migration from deprecated methods
311308

312-
`warpingFourPoints()` has been removed. 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()`.
309+
`warpingFourPoints()` has been removed. Now you have [`getPerspectiveWarp()`](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix 'internal link on perspective warp') that returns a matrix that can be applied on the image of interest in a new `transform()`.
313310

314311
```ts
315312
// Before
@@ -320,7 +317,7 @@ const matrix = getPerspectiveWarp(corners);
320317
const warped = img.transform(matrix);
321318
```
322319

323-
**Use cases**: Rectification of a perspective angle of an image. You can learn more about it [here](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix).
320+
**Use cases**: Rectification of a perspective angle of an image. You can learn more about it [here](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix 'internal link on perspective warp').
324321

325322
### `merge()`
326323

@@ -339,7 +336,7 @@ const img4 = merge([img1, img2, img3]);
339336

340337
### `correctColor()`
341338

342-
This function performs color correction using machine learning to match an image's colors to reference standards.
339+
This function performs color correction matches image's colors to reference standards.
343340

344341
```ts
345342
const measured = [
@@ -377,11 +374,12 @@ const pixelatedImage = image.pixelate({
377374
});
378375
```
379376

380-
**Use cases**: Creating retro 8-bit effects, reducing image detail for artistic purposes, or preparing images for low-resolution displays.
377+
**Use cases**: Creating retro 8-bit effects, preparing images for low-resolution displays or anonymization.
381378

382379
### `cropRectangle()`
383380

384381
While `crop()` and `cropRectangle()` might appear similar. However, they provide provide different approaches to extracting image regions.
382+
385383
`crop()` - Standard rectangular cropping that maintains the original image orientation:
386384

387385
```ts
@@ -410,34 +408,70 @@ const rotatedCrop = image.cropRectangle(points);
410408

411409
Use `crop()` for simple rectangular selections aligned with image axes, and `cropRectangle()` when you need to extract tilted or rotated rectangular regions.
412410

413-
### `drawMarkers()`
411+
### `drawPoints()`
414412

415-
Similarly to `drawPoints()`, `drawMarkers()` allows user to annotate an image. However,`drawMarkers()` creates visible markers (crosses, circles, squares, triangles)
416-
which gives a more prominent visual annotation. This gives a better alternative for highlighting or marking features.
413+
This function draws individual 1x1 pixel points at the specified coordinates. Unlike drawMarker() which creates shaped markers (circles, crosses, etc.), drawPoints() renders simple single-pixel points, making it ideal for dense point visualization or precise coordinate marking.
417414

418415
```ts
419416
const points = [
420417
{ row: 50, column: 100 },
421418
{ row: 150, column: 200 },
422419
];
423420

424-
const annotated = image.drawMarkers(points, {
425-
shape: 'circle', // Shape of a marker
426-
size: 5,
427-
color: [255, 0, 0], // Red markers
428-
filled: true,
421+
const annotated = image.drawPoints(points, {
422+
color: [255, 0, 0], // Red dots
429423
});
430424
```
431425

432-
Each marker is drawn centered on the specified point coordinates. The function creates a new image without modifying the original, making it ideal for creating annotated versions while preserving source data.
426+
Each point is drawn centered on the specified point coordinates. The function creates a new image without modifying the original, making it ideal for creating annotated versions while preserving source data.
427+
428+
**Use cases**: Plotting data points, marking precise coordinates, creating scatter plot overlays, visualizing pixel-level analysis results, dense feature visualization.
429+
430+
### `Mask` features
431+
432+
The `Mask` has been enhanced with new methods for geometric analysis and border processing.
433+
434+
#### `getFeret()`
433435

434-
**Use cases**: Marking detected features, annotating regions of interest, visualizing analysis results, creating overlays for presentations.
436+
Computes the [Feret diameters](https://en.wikipedia.org/wiki/Feret_diameter 'wikipedia link on Feret diameters') of the mask region, which are fundamental measurements in particle analysis and shape characterization. The Feret diameter represents the distance between two parallel lines that are tangent to the object's boundary.
437+
438+
```ts
439+
const feretDiameters = mask.getFeret();
440+
/*An object containing:
441+
minDiameter: The minimum Feret diameter (narrowest width)
442+
maxDiameter: The maximum Feret diameter (longest distance between any two boundary points)
443+
aspectRatio: Ratio of minimum to maximum diameter (minDiameter.length / maxDiameter.length)*/
444+
```
445+
446+
**Use cases**: Particle size analysis, shape characterization, elongation measurement, quality control in manufacturing, biological specimen analysis.
447+
448+
#### `getBorderPoints()`
449+
450+
Extracts all points that lie on the border/perimeter of the mask regions. This method identifies pixels that are part of the mask but have at least one neighboring pixel that is not part of the mask.
451+
452+
```ts
453+
const borderPoints = mask.getBorderPoints();
454+
// Returns: Array of {row: number, column: number} objects
455+
```
456+
457+
**Use cases**: Contour extraction, perimeter analysis, shape boundary detection.
458+
459+
#### `clearBorders()`
460+
461+
Removes mask regions that are connected to the image borders. This operation uses flood fill to eliminate any connected components that have pixels touching the edge of the image, useful for removing incomplete objects that extend beyond the image boundaries.
462+
463+
```ts
464+
const clearedMask = mask.clearBorder();
465+
// Returns a mask with removed borders.
466+
```
467+
468+
**Use cases**: Object segmentation cleanup, removing partial objects, preparing masks for complete object analysis, eliminating edge artifacts, preprocessing for particle analysis.
435469

436470
### `Stack` features
437471

438472
The Stack class has been significantly expanded with new methods for batch processing and statistical analysis of image collections.
439473

440-
#### Array-like Operations
474+
### Filtering and Transformations
441475

442476
A user can now filter images based on custom criteria using `filter()`:
443477

@@ -464,7 +498,7 @@ const modifiedStack = stack.map((img) => {
464498
});
465499
```
466500

467-
#### Statistical Operations
501+
### Stack Analysis Operations
468502

469503
It is now possible to generate a median image from the entire stack - useful for noise reduction and background subtraction:
470504

@@ -478,6 +512,10 @@ or create a cumulative sum of all images in the stack:
478512
const summedImage = stack.sum();
479513
```
480514

515+
**Use Cases**: Time-lapse analysis, scientific imaging.
516+
517+
### Stack Pixel Value Access
518+
481519
Access specific pixel values from any image in the stack using two convenient methods:
482520

483521
_By Coordinates_
@@ -503,58 +541,25 @@ const channel = 0;
503541
const pixelValue = stack.getValueByIndex(stackIndex, pixelIndex, channel);
504542
```
505543

506-
**Use Cases**: Time-lapse analysis, scientific imaging.
507-
508-
### Image comparison features
509-
510-
ImageJS now has several methods to check feature similarities between two images. For instance, let's take `computeSsim()`.
511-
SSIM ([Structural Similarity Index](https://en.wikipedia.org/wiki/Structural_similarity_index_measure)) is a value between -1 and 1 that measures how similar two images are in terms of:
512-
513-
- Luminance
514-
515-
- Contrast
516-
517-
- Structure
518-
519-
`computeSsim()` also has an opposite function `computeDssim()`. It checks _dissimilarities_ between two images.
520-
521-
```ts
522-
// 3x3 grayscale image
523-
const image = new Image(3, 3, {
524-
colorModel: 'GREY',
525-
data: new Uint8Array([5, 5, 5, 10, 10, 10, 15, 15, 15]),
526-
});
527-
const other = image;
528-
529-
console.log(computeSsim(image, other).mssim); // equals to 1, since images are the same.
530-
console.log(computeDssim(image, other)); // equals to 0, since function is the opposite of SSIM.
531-
```
532-
533-
ImageJS also includes such metrics like RMSE([Root Mean Square Error](https://en.wikipedia.org/wiki/Root-mean-square_deviation),measures the average magnitude of pixel differences between two images, giving more weight to larger errors) and PSNR( [Peak Signal-to-Noise Ratio](https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio), derived from MSE. It expresses the ratio between the maximum possible pixel value and the error (MSE))
544+
## πŸš€ Bug fixes
534545

535-
```ts
536-
// Rmse check
537-
computeRmse(image, other);
538-
//PSNR check
539-
computePsnr(image, other);
540-
```
541-
542-
**Use cases**: image quality measurement, detection of changes, or to evaluate visual similarity in tasks like compression, restoration, recognition, and tracking.
543-
544-
## πŸš€ Getting Started
546+
Bugs in multiple functions have been fixed:
545547

546-
To get started with ImageJS, we recommend visiting our ["Get started"](../docs/Getting%20started) guide
548+
- `cannyEdgeDetector()`
549+
- `resize()`
550+
- `drawCircle()`
547551

548552
## πŸ“š Resources
549553

550-
- [API Documentation](https://image-js.github.io/image-js-typescript/)
551-
- [Examples and Tutorials](https://image-js-docs.pages.dev/)
552-
- [GitHub Repository](https://github.com/image-js/image-js-typescript)
554+
- [API Documentation](https://image-js.github.io/image-js-typescript/ 'link on API')
555+
- [Examples and Tutorials](https://image-js-docs.pages.dev/ 'link on image-js tutorials and tips')
553556

554557
## 🀝 Contributing
555558

556559
We welcome contributions! The new TypeScript codebase makes it easier than ever to contribute.
557560

561+
- [GitHub Repository](https://github.com/image-js/image-js-typescript 'link on github repository')
562+
558563
## πŸ™ Acknowledgments
559564

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

0 commit comments

Comments
Β (0)