Right-Click Image Menu
A context menu is the small menu that appears when you right-click anything on a web page. Chrome extensions can add their own items to it via the contextMenus API. Scalpel Images adds two actions, each with its own shortcut in the settings panel.
Why it matters
Right-click is the fastest path to an action if you only want one image. Opening the full Scalpel Images popup, finding and selecting one photo, then clicking Download takes three steps. Right-clicking the image and hitting "Download this image via Scalpel" is one click.
And unlike the browser's native "save image as" command, this runs the download through Scalpel's naming pipeline: the query string is stripped from the URL, filesystem-hostile characters are cleaned, and even a data URI becomes a real file with a proper extension instead of a nameless blob.
How it works
Chrome and most Chromium browsers (Edge, Brave, Opera, Arc) support the chrome.contextMenus API, which lets an extension add its own items to the right-click menu.
Page context: Right-click on the page background (not on an image) and Scalpel adds "Grab images from this page." This opens the full Scalpel Images popup for the current tab, exactly as if you'd clicked the extension icon. It's a shortcut to the bulk-grab flow.
Image context: Right-click directly on an image element (an <img> tag, a <picture>, or even a CSS background) and Scalpel adds "Download this image via Scalpel." This downloads just that image, straight through the same naming pipeline as bulk download.
Parent menu: If you enable both items, Chrome groups them under a parent menu called "Scalpel Images" to keep the right-click menu tidy. If only one is enabled, it appears at the top level.
The download pipeline: When you use the right-click "Download this image" action, Scalpel:
- Detects the image URL (or converts canvas to data URI)
- Strips query strings and URL fragments
- Cleans filesystem-reserved characters from the filename
- Applies your filename pattern, if you've set one
- Downloads the file to your configured subfolder
This is identical to the bulk-download path, just for one image. So if you have a pattern set to {name}-{width}x{height}.{ext}, a right-click download follows it.
Settings toggle: The settings panel has an on/off switch for each context-menu item. This is persisted in chrome.storage.sync, so your choice follows you across your signed-in Chrome devices.
Keyboard shortcuts: The context menu is the primary UI, but you can also bind a keyboard shortcut to "grab images on this page" if you dive into chrome://extensions/shortcuts. Most users leave this at the default, but power users sometimes add a chord like Ctrl+Shift+G.
What does not matter
The right-click menu is advisory only. You don't have to use it; the popup is always available. Some people prefer the popup because it lets them see all images at once and select specific ones. The context menu just saves a click if you only want one.
The context menu only works on the current tab. It doesn't grab images from all open tabs or from your browsing history.
Not all right-click targets are images. Right-click an <svg> and Scalpel will try to extract it (SVG <img> tags work; inline SVG doesn't render as image data, so it's skipped). Right-click a <video> poster and nothing happens (that's not an image, it's a video element). This is by design: the menu only appears when the browser's right-click handler detects an image.
Code example
Here's how an extension registers a context-menu item:
// In the extension's background service worker or main script
chrome.contextMenus.create({
id: 'grab-images-page',
title: 'Grab images from this page',
contexts: ['page'], // Only show on page background, not on image elements
}, () => {
if (chrome.runtime.lastError) {
console.error('Context menu creation failed:', chrome.runtime.lastError);
}
});
chrome.contextMenus.create({
id: 'download-this-image',
title: 'Download this image via Scalpel',
contexts: ['image'], // Only show on image elements
}, () => {
if (chrome.runtime.lastError) {
console.error('Context menu creation failed:', chrome.runtime.lastError);
}
});
// Handle the click
chrome.contextMenus.onClicked.addListener((info, tab) => {
if (info.menuItemId === 'grab-images-page') {
// Open the popup for the tab
chrome.action.openPopup({ windowId: tab.windowId });
} else if (info.menuItemId === 'download-this-image') {
// Download the clicked image
chrome.tabs.sendMessage(tab.id, {
action: 'downloadImage',
url: info.srcUrl, // The image URL
pageUrl: info.pageUrl,
});
}
});
To read the user's preference for menu items from settings:
chrome.storage.sync.get(['showGrabPageMenu', 'showDownloadImageMenu'], (result) => {
const showGrab = result.showGrabPageMenu !== false; // Default to true
const showDownload = result.showDownloadImageMenu !== false;
// Re-create menus based on preference
chrome.contextMenus.removeAll(() => {
if (showGrab) {
chrome.contextMenus.create({
id: 'grab-images-page',
title: 'Grab images from this page',
contexts: ['page'],
});
}
if (showDownload) {
chrome.contextMenus.create({
id: 'download-this-image',
title: 'Download this image via Scalpel',
contexts: ['image'],
});
}
});
});
How Scalpel shows it
Right-click anywhere on a web page. If you're on the page background, you'll see "Grab images from this page" in the menu. Click it to open the full Scalpel Images popup.
Right-click directly on any image and you'll see "Download this image via Scalpel" (or just "Download this image" if that's the only item enabled). Click it and the image downloads straight away, using your saved filename pattern.
To manage these menu items, click the gear icon in the Scalpel Images popup header to open the settings panel. At the bottom, find two toggles: one for "Show grab-page menu item" and one for "Show download-image menu item." Toggle either one off and it disappears from your right-click menu. The settings sync across your devices, so if you turn off the download-image item on your laptop, it's off on your desktop too.
If both items are enabled, they'll nest under a parent "Scalpel Images" menu to keep your right-click context menu clean. If only one is enabled, it appears directly at the top level.