Rahul Gurung

Rahul Gurung

490 Articles Published

Articles by Rahul Gurung

Page 3 of 49

How to create a String representation of an Image object using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 389 Views

In this tutorial, we are going to show how you can create a String representation of an Image object using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to create a String representation of an Image object, we use the toString method. Syntax toString(): String Using the toString Method Let's see a code example to see the logged output when the toString method is ...

Read More

How to make a polygon object zoom-in and zoom-out using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 964 Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. To implement zoom functionality, we use the mouse:wheel event listener which detects mouse wheel movements and adjusts the canvas zoom level accordingly. Syntax canvas.on("mouse:wheel", callbackFunction); Example 1: Applying Zoom Controls on a Polygon Object Let's see a code example ...

Read More

How to create the instance of fabric.Image from a URL string using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 3K+ Views

In this tutorial, we are going to learn how to create the instance of fabric.Image from a URL string using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to create the instance of fabric.Image from a URL string, we use the fromURL method. Syntax fabric.Image.fromURL(url, callback, imgOptions) Parameters url − This parameter accepts a String which denotes the URL to create an image ...

Read More

How to make a star with Polygon class using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 754 Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Syntax new fabric.Polygon(points: Array, options: Object) Parameters points − This parameter accepts an Array which denotes the array of points that make up the polygon object. ...

Read More

How to crop an image along the X-axis using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we are going to learn how to crop an image along the x-axis using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to crop an image along the x-axis, we use the cropX property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { cropX: Number }: Object, callback: function) Parameters ...

Read More

How to serialize a Polygon object using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 321 Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Serialization is the process of converting an object into a format which is suitable for transfer over a network, which in this case is the object representation. In order to create an Object representation of a Polygon object, we use the toObject method. This method ...

Read More

How to crop the height in a cloned image using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 537 Views

In this tutorial, we are going to learn how to crop the height in a cloned image using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to crop the height in a cloned image, we use the height property. Syntax cloneAsImage(callback: function, {height: Number}: Object): fabric.Object Parameters callback (optional) − This parameter is a function which is to be invoked ...

Read More

How to straighten a rotated Polygon object using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 258 Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. We can straighten a rotated Polygon object by using the straighten method. The straighten method straightens an object by rotating it from its current angle to the nearest cardinal angle (0°, 90°, 180°, or 270°), depending on which is closer. Syntax straighten(): ...

Read More

How to crop the left offset in a cloned image using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 334 Views

In this tutorial, we are going to show how you can crop the left offset in a cloned image using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to crop the left offset in a cloned image, we use the left property. Syntax cloneAsImage( callback: function, { left: Number}: Object): fabric.Object Parameters callback (optional) − This parameter is a function ...

Read More

How to switch off object caching for a Polygon object using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 644 Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity, etc. A FabricJS object is cached on an additional canvas for saving time during re-using the object. In order to switch off object caching for Polygon object we use the objectCaching property. Syntax new fabric.Polygon( points: Array, { objectCaching: Boolean }: Object ) ...

Read More
Showing 21–30 of 490 articles
« Prev 1 2 3 4 5 49 Next »
Advertisements