Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To show only part of an image in Fabric.js, assign a normal Fabric object—such as a circle, rectangle, or polygon—to the image’s clipPath property. The mask controls visibility; it does not crop or enlarge the underlying pixels. For a frame that stays still while the image moves, use an absolute-positioned clip path and build the selection controls deliberately: Fabric.js provides the primitives, not a complete Canva-style image-mask widget.

Make a basic image mask

This example loads an image into a Fabric canvas and clips it to a circle. It assumes Fabric.js is already loaded and that the page contains a canvas element with the ID canvas. The image URL must be accessible to the browser; for a cross-origin image that you intend to export, the server must also permit cross-origin use.

const canvas = new fabric.Canvas('canvas');

const imageElement = new Image();
imageElement.onload = () => {
  const image = new fabric.FabricImage(imageElement, {
    left: 100,
    top: 80,
    scaleX: 0.6,
    scaleY: 0.6
  });

  const mask = new fabric.Circle({
    radius: 120,
    originX: 'center',
    originY: 'center'
  });

  image.set({ clipPath: mask });
  canvas.add(image);
  canvas.setActiveObject(image);
  canvas.requestRenderAll();
};
imageElement.src = 'https://example.com/photo.jpg';

Replace the example URL with an image you are authorized to use. In current Fabric.js usage, raster images are represented by FabricImage. The mask is a regular Fabric object assigned to image.clipPath; it is not an independent canvas selection tool.

A clip path acts as a visibility shape: pixels inside its filled area remain visible and pixels outside it are hidden. The clip path has no visible stroke in the clipping operation. Its origin is centered relative to the clipped object by default, so the mask’s originX and originY settings affect how it aligns.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Wacom Intuos Small, Wired Graphic Drawing Tablet with Pen + Software
  • Wacom Intuos Small Graphics Drawing Tablet: Enjoy industry leading tablet performance in superior control and precision with Wacom's EMR, battery free technology that feels like pen on paper
  • Works With All Software: Wacom Intuos tablet can be used in any software program to explore new facets of digital creativity; draw, paint, edit photos/videos, create designs, and mark up documents
  • What the Professionals Use: Wacom's industry leading pen technology and pen to paper feeling makes it the preferred drawing tablet of professional graphic designers
  • Software and Training Included: Only Wacom gives you software with every purchase. Register your Intuos tablet and gain access to some of the best creative software and Wacom's online training
  • Wacom is the Global Leader in Drawing Tablet and Displays: For over 40 years in pen display and tablet market, you can trust that Wacom to help you bring your vision, ideas and creativity to life

Choose between a clip path and a source crop

These approaches solve different problems. Use the one that matches whether you need a shaped viewport or a changed source-image region.

Need Use What it does
Show an image through a circle, rectangle, polygon, or grouped shape clipPath Hides pixels outside the mask. It does not automatically resize the visible pixels to fill the mask.
Start from a particular region of the source image, measured in its original pixels cropX and cropY Specify source-image cropping. They are image crop properties, not geometric masks.

You can combine cropping and a clip path if the design requires both a particular source region and a shaped boundary. Keep in mind that setting a mask alone does not make the remaining image fill a target frame. Set the image scale and position explicitly for that result.

Build a fixed frame with a movable image

In a typical editor, a user expects the frame to remain fixed while dragging or scaling the photo behind it. A regular, relative clip path follows the clipped object, so it is not by itself a fixed canvas-coordinate frame. Fabric.js supports absolute-positioned clipping; the documented effect is that the clipping shape stays steady while the clipped object can move beneath it.

Rank #2
Sale
XPPen Deco 01 V3 10x6 Drawing Tablet, 16K Battery-Free Stylus, 8 Keys
  • Word-first 16K Pressure Levels: The upgraded stylus features 16,384 levels of pressure sensitivity and supports up to 60 degrees of tilt, delivering smoother lines and shading for a natural drawing experience. With no battery or charging needed, it operates like a real pen, making it easy for beginners to create effortlessly. This functionality helps novice artists develop their skills and explore their creativity without the intimidation of complex tools
  • Designed for Beginners: This drawing pad desinged with 8 customizable shortcuts for both right and left-hand users, express keys create a highly ergonomic and convenient work platform
  • Perfectly Adapted for Android: The XPPen Deco 01 V3 art tablet supports connections with Android devices running version 10.0 and above. It is recommended to download the XPPen Tools Android application, which adapts to your smartphone's screen aspect ratio, ensuring accurate mapping. It also supports mapping on Android screens with different aspect ratios in portrait mode
  • Large Drawing Space, Bigger Bold Inspiration: This expansive drawing pad has10 x 6.25-inch helps you break through the limit between shortcut keys and drawing area
  • Easy Connectivity for Beginners: The Deco 01 V3 offers USB-C to USB-C connectivity, plus adapters for USB C. This ensures easy connection to various devices, allowing beginner artists to set up quickly and focus on their creativity without compatibility concerns. Whether using a laptop, tablet, or desktop, the Deco 01 V3 provides a seamless experience, making it an ideal choice for those just starting their digital art journey
  1. Create the image and set its clipPath to the desired frame shape.
  2. Set absolutePositioned: true on the clip-path object so its placement is in canvas coordinates rather than relative to the image.
  3. Position and size the frame deliberately, then test image movement and scaling against that coordinate model.
  4. Implement selection and controls so the user can manipulate the image without unintentionally moving the frame.
  5. When application code changes transforms outside Fabric’s normal interaction pipeline, update coordinates with setCoords() and request a render.
const frame = new fabric.Rect({
  left: 240,
  top: 160,
  width: 320,
  height: 220,
  originX: 'center',
  originY: 'center',
  absolutePositioned: true
});

image.set({ clipPath: frame });
canvas.requestRenderAll();

That snippet shows the fixed-frame property, not a complete editor interaction system. For a production editor, a common pattern is a selectable image underneath a separate frame shell that displays the border but is not exported as part of the image, or custom controls that translate the image while leaving the frame fixed. The shell, hit-testing behavior, and control constraints are application code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Decide what the user selects

Fabric’s standard object selection and controls support selecting objects and manipulating them, including scaling, rotation, resizing, and skewing. They do not automatically turn the visible portion of an image into a bespoke Canva-style selection widget. If the interaction must feel like selecting only the masked region, decide whether clicks should target the image, the frame, or a grouped editing object, and prototype that behavior against the exact Fabric.js version your application pins.

A maintainer discussion from January 2025 suggests using a group as the clip path together with a clip layout strategy for a Canva-like requirement. The discussion does not provide a complete implementation, so treat it as a direction to investigate rather than a drop-in recipe. Custom controls and selection event handlers may be needed.

Rank #3
Sale
HUION Inspiroy H640P 6x4 inch Drawing Tablet 8192 Pen Pressure
  • Customize Your Workflow: The 6 customizable press keys on Huion H640P drawing tablet for pc let you assign your most-used commands—like undo, zoom, brush switch, or save—so you can keep your hands on the tablet and your mind on the art. Whether you're a digital painter switching brushes, or a comic artist zooming in and out, these keys keep your workflow smooth and uninterrupted. Plus, the Huion driver lets you save different shortcut profiles for different apps, so you never have to reconfigure when switching software.
  • Professional Pen Performance: Huion H640P drawing pad for computer comes with the battery-free PW100 stylus that's always ready when inspiration strikes. With 8192 levels of pressure sensitivity, every light sketch, or bold stroke responds naturally to your hand—just like a real pen. The 5080 LPI resolution and 233 PPS report rate deliver lag-free, precise strokes, so you can draw confidently without second-guessing your cursor. The pen side buttons help you switch between pen and eraser instantly.
  • Compact and Portable: Huion H640P computer graphics tablet features a compact, ultra-portable design at just 0.3 inches thin and 0.61 lbs light, so it slides easily into your backpack—perfect for sketching in coffee shops, taking notes in class, or editing on the go between home and studio. The 6x4 inch active area offers enough room for natural pen movements while fitting comfortably on crowded desks, or lecture hall seats.
  • Stable Compatibility: Huion H640P graphic drawing tablet works seamlessly with Mac, Windows, Linux PCs, and Android smartphones/tablets (OS version 6.0 or later). Left-handed friendly, and you just need to flip the tablet and adjust the settings in the driver. Please note: H640P does NOT support iPhone/iPad.
  • Move Beyond the Mouse: Huion Inspiroy H640P is a pen tablet that replaces your mouse for more natural, precise control. Freehand draw, take notes, or even play OSU—everything you do with a mouse, you can do better with a pen. The precise tip makes it ideal for detailed photo editing, graphic design, or signing PDF. Meanwhile, the ergonomic pen grip helps you avoid the strain that comes from hours of using a mouse.

Use different mask shapes

Rectangle or circle

These are the simplest masks and are useful for common avatar, thumbnail, and framed-photo layouts. Construct the corresponding Fabric shape and assign it to clipPath. Set the mask origin and dimensions intentionally, then verify alignment at the image’s actual scale and position.

Polygon

A polygon can define an irregular visible region. As with other masks, it controls which pixels show; it does not automatically calculate a new scale that fills the polygon.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Grouped masks

A group can combine multiple clip objects. Group members behave with logical OR for clipping, rather than implementing SVG nonzero or evenodd clip-rule semantics. If you need holes or compound-path fill rules, do not assume a group of shapes will produce those results.

Rank #4
Sale
XPPen Artist 13.3 Pro V2 Drawing Tablet with Screen, 16K, Full-Laminated
  • PLEASE NOTE:XPPen Artist13.3 Pro drawing tablet Need to connect with computer,you need to use it with your computer or laptop, the 3 in 1 cable is included
  • Drawing Tablet with Screen: Tilt Function- XPPen Artist 13.3 Pro supports up to 60 degrees of tilt function, so now you don't need to adjust the brush direction in the software again and again. Simply tilt to add shading to your creation and enjoy smoother and more natural transitions between lines and strokes
  • Graphics Tablets: High Color Gamut- The 13.3 inch fully-laminated FHD Display pairs a superb color accuracy of 88% NTSC (Adobe RGB≧91%,sRGB≧123%) with a 178-degree viewing angle and delivers rich colors, vivid images, and dazzling details in a wider view. Your creative world is now as powerful as it is colorful
  • Drawing Pad: One is enough- The sleek Red Dial on the display is expertly designed with creators in mind, its strategic placement allows for natural drawing postures. With just one wheel, you can effortlessly zoom in and out, adjust brush sizes, and flip the canvas—all tailored to suit the habits of everyday artists. The 8 customizable shortcut keys allow you to personalize your setup, streamlining your workflow and enhancing creative efficiency
  • Universal Compatibility & Software Support:supports Windows 7 (or later), Mac OS X 10.10 (or later), Chrome OS 88 (or later), and Linux systems. Fully compatible with major creative software including Photoshop, Illustrator, SAI, and Blender 3D. Register your device to access additional programs like ArtRage 5 and openCanvas for expanded creative possibilities.

Inversion has an additional group-level edge case: for an inverted clip group, invert the group itself. Inverting individual objects inside a clip group is not supported by the documented behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fit the image inside the mask

A mask only decides which pixels are visible. To fill a rectangular frame without empty gaps, calculate an image scale and position that cover the frame. For a simple axis-aligned frame and an image of intrinsic width iw and height ih, with frame width fw and height fh, a cover scale is max(fw / iw, fh / ih). Then position the scaled image so the desired subject area sits inside the frame. This is layout math for your editor, not an automatic effect of clipPath.

For rotated images, image and mask transforms must use the same coordinate model. Coordinate reasoning becomes more complex when the image is rotated, the frame is absolute-positioned, or application code updates transforms directly. Use Fabric’s positioning and coordinate methods as appropriate, call setCoords() after direct transform changes, mark an object dirty when required by your update path, and request a canvas render.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Drawing Tablet XPPen StarG640 Digital Graphic Tablet 6x4 Inch Art Tablet with Battery-Free Stylus Pen Tablet for Mac, Windows and Chromebook (Drawing/E-Learning/Remote-Working)
  • Battery-Free Pen: StarG640 drawing tablet is the perfect replacement for a traditional mouse! The XPPen advanced Battery-free PN01 stylus does not require charging, allowing for constant uninterrupted Draw and Play, making lines flow quicker and smoother, enhancing overall performance
  • Ideal for Online Education: XPPen G640 graphics tablet is designed for digital drawing, painting, sketching, E-signatures, online teaching, remote work, photo editing, it's compatible with Microsoft Office apps like Word, PowerPoint, OneNote, Zoom, Xsplit etc. Works perfect than a mouse, visually present your handwritten notes, signatures precisely
  • Compact and Portable: The G640 art tablet is only 2 mm thick, it's as slim as all primary level graphic tablets, allowing you to carry it with you on the go
  • Chromebook Supported: XPPen G640 digital drawing tablet is ready to work seamlessly with Chromebook devices now, so you can create information-rich content and collaborate with teachers and classmates on Google Jamboard’s whiteboard; Take notes quickly and conveniently with Google Keep, and effortlessly sketch diagrams with the Google Canvas
  • Multipurpose Use: Designed for playing OSU! Game, digital drawing, painting, sketch, sign documents digitally, this writing tablet also compatible with Microsoft Office programs like Word, PowerPoint, OneNote and more. Create mind-maps, draw diagrams or take notes as replacement for mouse

Common problems and fixes

  • The image is visible but not clipped: Confirm that the mask object was assigned to the image’s clipPath before rendering, and request a render after changing it.
  • The mask is offset: Check originX and originY. A normal clip path is positioned relative to the clipped object’s center; absolute positioning uses canvas coordinates instead.
  • The image moves the frame: The clip path is likely behaving relative to the image. For a stationary frame, use an absolute-positioned clip path and keep the coordinate management consistent.
  • The frame is filled only partly: Clipping does not enlarge the visible pixels. Calculate the image scale and position needed to cover the frame.
  • Grouped shapes create unexpected holes or overlaps: Group members use OR clipping behavior and do not supply SVG nonzero or evenodd clip-rule behavior. Redesign the mask or use a representation that supports the required fill semantics.
  • Inverting a grouped mask does not work as expected: Invert at the group level; inversion of individual members inside a clip group is unsupported.
  • Programmatic movement leaves stale hit areas or coordinates: After changing transforms outside the standard interaction flow, call setCoords() and render again.
  • An image fails to load or export: Check the image URL and browser cross-origin restrictions. A remote image server must permit the intended use if the canvas will be exported.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server, not a Fabric.js masking library; use it when you need a screenshot of a page that contains your canvas editor, rather than to implement image selection inside Fabric. One GET request returns an image or PDF. The URL below uses the ScreenshotNeo API as documented; replace the target URL and API key with your own. See the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://example.com/editor 
  -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report page verdict and billing status. Its MCP server includes screenshot, page-info, and PDF-capture tools for AI agents. The Free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can a clip path itself be selected as a separate visible object?

Not as a built-in masked-image widget. Fabric.js provides objects, selection events, and customizable controls; the editor must define how the mask and image participate in selection.

Will a circle clip path crop the source image permanently?

No. It hides pixels outside the circle for rendering. Use the image crop properties when you need to specify a source-image region.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I make a group mask with a hole in the middle?

A group combines members with OR clipping behavior and does not provide SVG nonzero or evenodd clip-rule behavior. Do not rely on grouped masks to create compound-path holes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.