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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use PIL.ImageGrab.grab(bbox=...) when you need the pixels currently displayed on screen. Use Canvas.postscript(x=..., y=..., width=..., height=...) when you need a bounded export of the Canvas drawing itself. They are different operations: ImageGrab captures a desktop rectangle, while postscript() produces PostScript content, not a PNG screenshot.

The reliable workflow is to decide which output you need, translate Canvas coordinates into screen coordinates when necessary, let Tk finish laying out the widget, and then save or convert the result.

Choose pixels or Canvas content first

Requirement Use What you get
Match exactly what the user sees, including current rendering and clipping ImageGrab.grab(bbox=...) Screen pixels that can be saved directly as PNG, JPEG or another Pillow format
Export drawing items independently of desktop composition Canvas.postscript(...) PostScript representation of a Canvas region

ImageGrab depends on the desktop: a covered, minimized or not-yet-rendered window can produce an unintended image. PostScript does not include desktop chrome and is not itself a raster image; convert it separately if your pipeline requires PNG or JPEG. Tk transforms the Canvas’s upper-left coordinate system for PostScript’s lower-left origin during export.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Capture a visible rectangular portion as screen pixels

A Pillow screenshot bbox is a screen rectangle: (left, top, right, bottom). Tkinter gives the Canvas’s screen origin through winfo_rootx() and winfo_rooty(), and its displayed size through winfo_width() and winfo_height(). Add widget-relative offsets to that origin for a partial crop.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Complete example: crop by Canvas-widget offsets

import tkinter as tk
from PIL import ImageGrab

root = tk.Tk()
root.title("Canvas capture")
canvas = tk.Canvas(root, width=600, height=400, background="white")
canvas.pack()

# Example drawing
canvas.create_rectangle(40, 40, 560, 360, outline="navy", width=3)
canvas.create_text(300, 200, text="Capture this region", fill="black", font=("Arial", 24))

# Let geometry and drawing settle before measuring screen coordinates.
root.update_idletasks()

# Crop 20 pixels from each Canvas edge.
offset_left, offset_top = 20, 20
offset_right, offset_bottom = 20, 20
left = canvas.winfo_rootx() + offset_left
top = canvas.winfo_rooty() + offset_top
right = canvas.winfo_rootx() + canvas.winfo_width() - offset_right
bottom = canvas.winfo_rooty() + canvas.winfo_height() - offset_bottom

image = ImageGrab.grab(bbox=(left, top, right, bottom))
image.save("canvas-part.png")

root.mainloop()

Call the capture after the window is mapped and visible. In an event-driven application, a button callback, after() callback, or code that runs after root.update_idletasks() is safer than taking the image immediately after creating widgets. Pillow currently returns RGBA on macOS and RGB elsewhere; normalize with image.convert("RGB") if the next step requires one mode.

Capture an arbitrary widget-relative rectangle

For a rectangle whose top-left corner is (x0, y0) inside the Canvas and whose dimensions are w by h:

root.update_idletasks()
left = canvas.winfo_rootx() + x0
top = canvas.winfo_rooty() + y0
bbox = (left, top, left + w, top + h)
ImageGrab.grab(bbox=bbox).save("region.png")

The right and bottom edges are exclusive in the usual Pillow rectangle convention, so the resulting dimensions are normally w by h. Clamp your offsets if they can come from user input; a negative width or height is an input error, not a scrolling fix.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Capture drawing coordinates from a scrolled Canvas

Scrolling separates three coordinate spaces:

  • Canvas/world coordinates: the coordinates used when creating items.
  • Widget coordinates: positions inside the currently displayed Canvas window.
  • Screen coordinates: desktop pixels required by ImageGrab.

If the requested rectangle is expressed in Canvas/world coordinates, convert its corners to the displayed view with canvas.canvasx() and canvas.canvasy(), then translate by the widget’s screen origin.

Scrolled-canvas example

import tkinter as tk
from PIL import ImageGrab

root = tk.Tk()
canvas = tk.Canvas(root, width=500, height=300, scrollregion=(0, 0, 2000, 1200))
xbar = tk.Scrollbar(root, orient="horizontal", command=canvas.xview)
ybar = tk.Scrollbar(root, orient="vertical", command=canvas.yview)
canvas.configure(xscrollcommand=xbar.set, yscrollcommand=ybar.set)
canvas.grid(row=0, column=0)
ybar.grid(row=0, column=1, sticky="ns")
xbar.grid(row=1, column=0, sticky="ew")

for x in range(0, 2000, 100):
    canvas.create_line(x, 0, x, 1200, fill="#dddddd")
for y in range(0, 1200, 100):
    canvas.create_line(0, y, 2000, y, fill="#dddddd")
canvas.create_rectangle(700, 450, 980, 650, outline="red", width=4)

# Scroll somewhere before capturing.
canvas.xview_moveto(0.25)
canvas.yview_moveto(0.20)
root.update_idletasks()

# World-coordinate region to capture.
world_x0, world_y0 = 700, 450
region_w, region_h = 280, 200

# Convert world coordinates to positions in the displayed Canvas window.
view_x0 = canvas.canvasx(world_x0)
view_y0 = canvas.canvasy(world_y0)
view_x1 = canvas.canvasx(world_x0 + region_w)
view_y1 = canvas.canvasy(world_y0 + region_h)

left = canvas.winfo_rootx() + (view_x0 - canvas.canvasx(0))
top = canvas.winfo_rooty() + (view_y0 - canvas.canvasy(0))
right = canvas.winfo_rootx() + (view_x1 - canvas.canvasx(0))
bottom = canvas.winfo_rooty() + (view_y1 - canvas.canvasy(0))

ImageGrab.grab(bbox=(left, top, right, bottom)).save("scrolled-region.png")
root.mainloop()

canvasx() and canvasy() convert a position in the Canvas window to the Canvas coordinate displayed there. The subtraction of the converted origin above yields widget-relative pixels after scrolling. An equivalent approach is to convert the world rectangle’s corners and use the resulting displayed offsets directly; the important rule is never to pass world coordinates straight to Pillow.

Use bbox() carefully

canvas.bbox(item_or_tag) returns an approximate bounding box for Canvas items in Canvas pixels. It can overestimate by a few pixels, and it is not a screen rectangle. To capture that box with ImageGrab, translate its corners through the current scroll view and then add the Canvas’s screen origin. If a tight crop matters, apply a final Pillow crop or account for stroke width and antialiasing.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Export a bounded Canvas region as PostScript

When desktop visibility is irrelevant, export the drawing region directly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
# x0 and y0 are Canvas/world coordinates.
canvas.update_idletasks()
ps_text = canvas.postscript(
    colormode="color",
    x=x0,
    y=y0,
    width=region_width,
    height=region_height,
)
with open("region.ps", "w", encoding="utf-8") as file:
    file.write(ps_text)

You can also let Tk write the file:

canvas.postscript(
    file="region.eps",
    colormode="color",
    x=x0,
    y=y0,
    width=region_width,
    height=region_height,
)

The method generates Encapsulated PostScript version 3.0. Without explicit bounds it defaults to the currently visible Canvas area. Call update() when pending drawing changes must be processed before export; explicit width and height also avoid relying on an unsettled geometry calculation. Convert the resulting PostScript with a suitable rasterization tool if a PNG is required. Do not feed PostScript page coordinates into Pillow’s bbox; their origin conventions differ.

ImageGrab versus PostScript: practical trade-offs

Axis Pillow ImageGrab Canvas PostScript
Fidelity target Current rendered desktop appearance Canvas drawing export
Input coordinates Screen rectangle Canvas-region options
Scrolling and layout Requires Canvas-to-widget-to-screen translation Tk maps Canvas coordinates for export
Output Image object, immediately saveable PostScript text or file
Operational concerns Desktop permissions, monitor offsets and Retina scaling Tcl/Tk PostScript behavior and a separate raster-conversion step

Retina, multi-monitor and platform details

macOS Retina

On macOS Retina displays, Pillow documents that bbox captures are 2× by default. If your saved image must have one pixel per logical point, use scale_down=True where your installed Pillow version supports it (documented as added in Pillow 12.3.0):

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
image = ImageGrab.grab(bbox=bbox, scale_down=True)

Check your Pillow version before using that keyword; older installations will reject it. Without downscaling, size your downstream layout for the larger pixel dimensions.

Multiple monitors and desktop permissions

Screen origins can be negative or otherwise nonzero on a multi-monitor desktop, which is why winfo_rootx() and winfo_rooty() are preferable to assuming the primary display starts at (0, 0). Operating-system privacy settings may also block screen capture. Grant the Python application the required screen-recording permission, then retry with a visible, unobscured window.

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

Troubleshooting checklist

  • Blank or stale image: capture after update_idletasks() or update(), and ensure the window is visible and not covered.
  • Crop shifted after scrolling: you passed world coordinates as screen coordinates. Convert with canvasx()/canvasy() first.
  • Extra pixels around an item: bbox() is approximate and may include a few pixels for outlines; crop or compensate for stroke width.
  • PostScript file is not a PNG: that is expected. Rasterize it separately, or use ImageGrab when rendered pixels are the requirement.
  • Wrong size on Retina: account for the documented 2× capture or use scale_down=True on a compatible Pillow release.
  • ImageGrab import fails: install Pillow in the same Python environment that runs Tkinter, then verify the interpreter and package versions.
  • Window position changes between measurement and capture: keep the window stationary during the two operations and perform both on the GUI thread.
  • Transparent or platform-specific Canvas features differ: choose the method that matches the required fidelity and verify the output on the target operating system.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance and reliability guidance

Capture only the rectangle you need; smaller screen regions use less memory and finish faster. Reuse a single Tk window for repeated captures instead of creating and destroying windows. For deterministic exports in automated jobs, PostScript avoids desktop occlusion and monitor placement, but it still depends on Tk’s rendering and export support. For ImageGrab, serialize captures with GUI updates so geometry is stable, and normalize image mode before encoding. If a capture is part of a test or documentation pipeline, record the requested rectangle, scroll position, display scale and Pillow version alongside the artifact.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Or skip the browser setup

If the thing you need is a website screenshot rather than a local Tkinter window, ScreenshotNeo returns a clean PNG, JPEG, WebP or PDF from one request. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and each response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

One-call examples

See the ScreenshotNeo documentation for parameters and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Every plan includes the same feature set, including full-page lazy-image loading, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, blocking rules, headers, cookies, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data and an OpenAPI specification. The parameter names used by other screenshot APIs also work for easier migration.

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

The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free. Create a free ScreenshotNeo account to try it without a card.

Frequently Asked Questions

Can I capture content outside the visible Canvas viewport with ImageGrab?

Not as a single desktop rectangle unless that content is rendered on screen. Scroll and capture multiple visible regions, or export the off-screen drawing with Canvas PostScript.

Why does my screenshot include window borders or other applications?

Your screen bbox is larger or offset from the Canvas widget. Recompute it from winfo_rootx(), winfo_rooty(), winfo_width() and winfo_height(), then apply only widget-relative offsets.

Should I call update() or update_idletasks()?

Use update_idletasks() for geometry and pending layout work. Use update() when drawing changes themselves must be processed before PostScript export, while avoiding uncontrolled event-loop re-entry in complex applications.

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

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.