Skip to content

Fixes to rendering images #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2021
Merged

Fixes to rendering images #52

merged 1 commit into from
May 27, 2021

Conversation

DonJayamanne
Copy link
Contributor

@DonJayamanne DonJayamanne commented May 27, 2021

Fixes microsoft/vscode-jupyter#6002 (comment)
(converting bytes to base64 is an inefficient approach, using native Blobs)

: isJson
? cellInfo.json()
: cellInfo.text();
const value = isImage ? cellInfo.blob() : isJson ? cellInfo.json() : cellInfo.text();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more efficient way, using Blob

@@ -51,11 +51,7 @@ function convertVSCodeOutputToExecutResultOrDisplayData(
): nbformat.IExecuteResult | nbformat.IDisplayData {
const isImage = cellInfo.mime.toLowerCase().startsWith('image/');
const isJson = cellInfo.mime.toLowerCase().includes('json');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the isJson function was wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't it need to check for actual json? Although I think that's a separate bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes thats wrong, waiting on @IanMatthewHuff not sure if he's working on a fix for that or not.
This issue fixes the image rendering issue.

@DonJayamanne DonJayamanne merged commit 88a1ec4 into main May 27, 2021
@DonJayamanne DonJayamanne deleted the fixesToImageRenderer branch May 27, 2021 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ipynb files with matplotlib figures do not open
2 participants