nagata-yoshiteru / pbm-ppm-pgm-viewer-for-vscode Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Using v1.1.4 of the extension
I was following the Ray tracing in one weekend tutorial but the images generated using the sample code provided there are not rendered.
I get this blank screen on opening the ppm file.
The contents of the ppm file are as per requirement of P3.
Here is the code being used to generate the P3 file.
#include <iostream>
#include<random>
#include<ctime>
#include "vector.h"
int main() {
srand(time(NULL));
int nx = 300;
int ny = 200;
std::cout << "P3\n" << nx << " " << ny << "\n255\n";
for (int j = ny-1; j >= 0; j--) {
std::cerr<<"Scanlines remaining :"<<j<<std::flush;
for (int i = 0; i < nx; i++) {
float tmp = rand() / static_cast<float>(RAND_MAX);
vec3 col = vec3(tmp,tmp,tmp);
int ir = int(255.99*col[0]);
int ig = int(255.99*col[1]);
int ib = int(255.99*col[2]);
std::cout << ir << " " << ig << " " << ib << " ";
}
std::cout<<"\n";
}
}
You can view the specific image.ppm
file here and reproduce the issue.
Great extension!
Would be great if the UI could be drawn on the RHS (so that when sharing screen-grabs that include the image title the big red UI is out-of-view).
Opening a PPM file works fine, but it isn't reloading when that image changes. I am writing to the file whenever my source file changes, and the image display never updates. I'm running on Windows. Closing the file and opening it again displays the new contents.
Great Extension!
I'm using it with very small images and it gets annoying having to zoom in on each one. Would be great if someone can add a "Default Zoom" to the settings. Or perhaps an "Auto-zoom" so that small images are rendered to fit the available space.
See Netpbm on wikipedia https://en.wikipedia.org/wiki/Netpbm for PAM, P7.
When a P6 has a maxval (denominator) greater than 255, each color is stored in two bytes but the extension code is only reading 1 byte, meaning that a completely wrong image is shown (because each pixel's 6 bytes are interpreted as 2 different pixels, the first from the RRG bytes and the second from the GBB bytes). See https://linux.die.net/man/5/ppm and
pbm-ppm-pgm-viewer-for-vscode/src/parsing.ts
Lines 209 to 217 in 2d5f005
private _createWebView(
newDocument: ImagePreviewDocument,
webviewPanel: vscode.WebviewPanel
) {
const { status, width, height, imgType } = newDocument.imageData;
if (status === parse.PARSE_STATUS.SUCCESS) {
webviewPanel.webview.html = generateHTMLCanvas(
JSON.stringify(newDocument.imageData),
width || 0,
height || 0,
imgType || "",
webviewPanel.title
);
}
}
Calling newDocument.imageData
twice here results in repeated parsing of the data. It is suggested to change it to this:
private _createWebView(
newDocument: ImagePreviewDocument,
webviewPanel: vscode.WebviewPanel
) {
let data = newDocument.imageData;
if (data.status === parse.parseStatus.success) {
webviewPanel.webview.html = generateHTMLCanvas(
JSON.stringify(data),
data.width || 0,
data.height || 0,
data.imgType || "",
webviewPanel.title
);
}
}
Hi! I wrote this PPM viewer for vscode earlier this year, https://github.com/BenWeisz/TinyViewer, I was wondering if you would be interested in collaborating. I could add the character formats P3, P2 for your PPM viewer. Let me know, thanks!
I am using gitPod and cannot find this extension. It looks like it needs to be published on Open VSX:
https://www.gitpod.io/blog/open-vsx-in-gitpod
Below are a list of future features we are planning to add:
Ctrl
key + mouse scrollIf you are a new collaborator, feel free to take any of these on!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.