Git Product home page Git Product logo

pbm-ppm-pgm-viewer-for-vscode's People

Contributors

benweisz avatar cristiano605 avatar daniels6 avatar dependabot[bot] avatar fryguy avatar jean-lourenco avatar momokichi avatar nagata-yoshiteru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pbm-ppm-pgm-viewer-for-vscode's Issues

P3 images not rendered

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.
image
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.

"UI Position" setting would be handy

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).

Auto refresh isn't working

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.

"Default Zoom" setting would be handy

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.

P6 with maxval > 255 not rendered correctly

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

case "P6": {
while (pixelIndex < totalPixels) {
colorData.push({
r: byteData[index],
g: byteData[index + 1],
b: byteData[index + 2],
});
pixelIndex += 1;
index += 3;

The data was parsed repeatedly

  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
      );
    }
  }

Future Features - Good First Tasks

Below are a list of future features we are planning to add:

  • Zoom in and out with Ctrl key + mouse scroll
  • Performance improvement for large images ( Thanks @Fryguy )
  • Support more wide variety of image formats (namely P1 & P4)
  • Showing the pixel data in the zoom panel for the pixel your mouse is over
  • Auto refresh viewer when file has changes
  • Make it easier for users to switch between text mode and display mode of image
  • Auto zoom when file is first opened
  • Add support for PAM (P7)

If you are a new collaborator, feel free to take any of these on!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.