Repository navigation
Releases
Releases · 076923/python-image-preview
1.2.0
- Fixed: thumbnails and the hover rendered RGB arrays with OpenCV (BGR) when
cv2was installed, so colors were swapped. New settingpythonImagePreview.arrayRenderer(defaultmatplotlib) picks the renderer used first for plain arrays - Grid renderer: every item of a batch (
N×C×H×W,N×H×W×C) tiled into one image, offered for arrays and tensors with 4 dimensions - Inspector: a viewer with zoom and pan, the value of the pixel under the cursor, R/G/B/A/gray channel toggles and a histogram. Open it from
[Inspect]at the bottom of the Quick Fix menu, Inspect Image in the Variables view's context menu or the hover's Inspect link, make it the default withpythonImagePreview.viewer, or right-click an image file in the Explorer - Hover and thumbnail tooltips show
min,maxandmeannext to the shape and dtype Ctrl+Alt+P(macOS⌘+Alt+P) previews the variable at the cursor or the selection with the first applicable renderer, without a menu (Preview Image with Default Renderer, also in the editor context menu)- Thumbnails are rendered at reduced size in the debugged process (arrays are subsampled, figures saved at a lower dpi, Pillow images shrunk), so stepping through functions with large images stays fast; the full-size file is written only when a preview is opened
- New object types: xarray
DataArray, daskArray, OpenCVUMat, torchvisionImage/Mask/Videotv_tensors - Command titles and setting descriptions are localized; Korean is included (
package.nls.ko.json)
1.1.0
- Renderers are only probed (
importlib.util.find_spec) when the Quick Fix menu opens; the image is rendered when you pick one. Hovering the lightbulb no longer writes files or imports libraries in the debugged process, and failures now show an error with a Show Log button - Libraries that share a type name (PIL and SimpleITK
Image, Matplotlib/Plotly and BokehFigure) are told apart by module, so only the renderer that applies is offered - Hovering an image-like variable with
Altheld while paused shows its type, shape and dtype with a thumbnail and links to open the full preview (pythonImagePreview.hoverPreview,pythonImagePreview.hoverThumbnailWidth,pythonImagePreview.hoverThumbnailHeight) - Inline thumbnails: each visible mention of an image-like local variable gets a small thumbnail before its name; hovering it shows the larger preview and renderer links without holding Alt (
pythonImagePreview.inlineThumbnails,pythonImagePreview.inlineThumbnailHeight,pythonImagePreview.inlineThumbnailLimit) - Inline Values: lines mentioning an image-like local variable show
img: (480, 640, 3) uint8at their end.pythonImagePreview.inlineValueschooses betweenimages(image-like variables only),all(other variables show their value too, except modules, functions and classes) andoff(default) Python Image Preview: Open Settingscommand- Preview Image in the Variables view context menu; asks for the renderer if several apply
- A selected expression (
img[..., 0],batch[0],self.model.weight) can be previewed, not only the word under the cursor - Uses the frame selected in the Call Stack view instead of always the top frame of the first stopped thread
- New setting
pythonImagePreview.grayscaleColormap(defaultgray); 2-D arrays rendered with Matplotlib were previously saved withviridis - Fixed:
uint16arrays were clipped to white and negative floats (-1..1tensors) to black; both are now min-max scaled.NaNis mapped to 0 - Fixed:
float16/bfloat16PyTorch tensors failed to convert - Fixed: masked entries of
MaskedArrayshowed their raw values; they are filled with 0 - Fixed: preview files were deleted when a debug session of another language ended
1.0.0
First stable release.
- Modernized build: esbuild bundle, TypeScript 5, ESLint 9, VS Code
^1.90 - Activates for the
debugpydebug type as well aspython; fixes the crash on running threads in recent VS Code and the "command not found" error - Runs where the debugger runs, so Remote-SSH / WSL / Dev Containers work
- Preview images are written under the OS temp directory (configurable via
pythonImagePreview.cacheDirectory) instead of__pycache__/previewnext to the source file, and are removed when the debug session ends - Variables are also resolved from the Globals scope
- New libraries: JAX, CuPy, pandas (
DataFrame/Seriesvia.plot()), SimpleITK, nibabel, Bokeh (needs selenium or playwright), Altair (needs vl-convert-python) - Matplotlib
Axes/SubFigureand seabornFacetGrid/PairGrid/JointGridcan be previewed (resolved to their figure) - Arrays and tensors are normalized before saving: batch dimension dropped, CHW → HWC, single channel squeezed, bool/uint16/float ranges mapped to uint8
- No longer imports
matplotlib.pyplotinside the debuggee, so thematplotlib.use("Agg")workaround is not needed and the user's backend is left untouched - Python errors inside the debuggee are caught and logged to the "Python Image Preview" output channel instead of failing silently
- PyTorch tensors on any device are previewed via
.detach().cpu() - Commands:
Python Image Preview: Preview Image at Cursor(also in the editor context menu while debugging),Python Image Preview: Clear Preview Cache - Settings:
pythonImagePreview.cacheDirectory(supports${workspaceFolder},${fileDirname},${env:NAME}…),pythonImagePreview.keepHistory(every preview in its own tab for side-by-side comparison),pythonImagePreview.clearOnSessionEnd,pythonImagePreview.openBeside; changes apply without reload
Beta (0.0.1 – 0.1.2)
- Supported libraries: NumPy, Pillow, OpenCV, Matplotlib (including pyplot figures), Seaborn, Plotly (
kaleidorequired), ImageIO, scikit-image, TensorFlow, PyTorch (including CUDA tensors) - Preview of
self.<attribute>members - Multi-thread debug sessions
- Auto import of required modules inside the debuggee