Skip to content

nedsion/element2img

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Element Capture

A Chrome extension that allows you to select and capture specific HTML elements as images with a simple point-and-click interface.

Features

  • 🎯 Interactive Element Selection - Hover over any element on a webpage to highlight it
  • 📸 High-Quality Capture - Captures elements with proper resolution and pixel-perfect accuracy
  • 💾 Automatic Download - Captured images are automatically saved to your downloads folder
  • ⌨️ Easy Cancellation - Press ESC to exit selection mode anytime
  • 🎨 Visual Feedback - Clear overlay and instructions guide you through the capture process

Installation

From Source

  1. Clone or download this repository:

    git clone https://github.com/nedsion/element2img.git
  2. Open Chrome and navigate to chrome://extensions/

  3. Enable Developer mode by toggling the switch in the top right corner

  4. Click Load unpacked and select the extension directory

  5. The Element Capture icon should now appear in your Chrome toolbar

Usage

  1. Navigate to any webpage you want to capture elements from

  2. Click the Element Capture extension icon in your toolbar

  3. Click the Start Element Selection button in the popup

  4. Hover over the element you want to capture:

    • A blue overlay will highlight the element under your cursor
    • An instruction banner will appear at the top of the page
  5. Click on the highlighted element to capture it

  6. The captured image will automatically download to your downloads folder

  7. Press ESC at any time to cancel the selection mode

How It Works

The extension uses the following technologies:

  • Chrome Extension Manifest V3 - Modern extension architecture
  • Chrome Tabs API - Captures visible tab screenshots
  • Content Scripts - Provides interactive element selection
  • Canvas API - Crops and processes the captured element

The capture process:

  1. Content script highlights elements as you hover
  2. When you click, the element is scrolled into view
  3. A screenshot of the visible tab is captured
  4. The screenshot is cropped to the exact element boundaries
  5. The cropped image is downloaded automatically

File Structure

.
├── manifest.json          # Extension configuration
├── popup.html            # Extension popup UI
├── popup.js              # Popup logic
├── content.js            # Element selection and highlighting
├── background.js         # Screenshot capture and processing
├── html2canvas.min.js    # Canvas library (reference)
└── icons/
    ├── icon16.png        # 16x16 icon
    ├── icon48.png        # 48x48 icon
    └── icon128.png       # 128x128 icon

Permissions

This extension requires the following permissions:

  • activeTab - Access to the currently active tab for capturing
  • scripting - Inject content scripts for element selection
  • downloads - Save captured images to your downloads folder

Browser Compatibility

  • Chrome 88+ (Manifest V3 support required)
  • Edge 88+ (Chromium-based)

Development

Prerequisites

  • Google Chrome or Chromium-based browser
  • Basic knowledge of Chrome Extension development

Making Changes

  1. Edit the source files as needed
  2. Go to chrome://extensions/
  3. Click the refresh icon on the Element Capture extension card
  4. Test your changes

Debugging

  • Popup: Right-click the extension icon → Inspect popup
  • Content Script: Open DevTools on the webpage (F12)
  • Background Script: Go to chrome://extensions/ → Click "service worker" link

Known Limitations

  • Cannot capture elements from Chrome internal pages (chrome://, chrome-extension://)
  • Cannot capture across different origins without proper permissions
  • Screenshot quality depends on the device's pixel ratio
  • Very large elements may take slightly longer to process

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is open source and available under the MIT License.

Author

nedsion

Support

If you encounter any issues or have questions:

  • Open an issue on GitHub
  • Check existing issues for solutions

Changelog

Version 1.0

  • Initial release
  • Interactive element selection with hover highlighting
  • High-quality element capture
  • Automatic image download
  • ESC key cancellation
  • Visual feedback with overlay and banner

Made with ❤️ by nedsion

About

Element2img - Just an extension to capture specify element you selected to image file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors