Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Getting wrong color when drawing large image

未关闭
#707 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, nodejs

调研方向

首先使用 nodejs、getPixels() 和 3634x5451 的图像重现报告的 drawImage 内核,并将其与成功的 1000x1000 案例进行比较。检查 setGraphical(true) 的输出和像素读回路径;当大图像以匹配的颜色重新绘制,而不是产生报告中的错误输出时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

First of all , thank you for your great work.
I've been trying to follow wobbling cat example but first I started by redrawing an image. I use nodejs and getPixels() method instead of getting a canvas. It all works fine with cat.jpg and other 1000 x 1000 images but when I use large (3634x5451) image this is what happened.

rotated

CODE

const kernel = function(image) {
      let x = this.thread.x,
          y = this.thread.y;
          
      const n = 4 * ( x + this.constants.w * (this.constants.h - y) );
      this.color(image[n] / 256, image[n+1] / 256, image[n+2] / 256, image[n+3] / 256)
    }

const drawImage = gpu.createKernel(kernel)
      .setConstants({ w: width, h: height})
      .setOutput([width, height])
      .setGraphical(true)

drawImage(buffer)
const pixels = drawImage.getPixels()
gpu.destroy()

// write image file with returned pixels

Running on

  • NodeJS : 14.17.3
  • gpu.js : 2.11.3
  • jpeg-js : 0.4.3
  • AMD Radeon Pro 5300M

Original image
It should just redraw the same image.

car

Importance : 3

主要语言
JavaScript
星标
15.5k
派生
666
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

gpujs/gpu.js 的其他 Issue

查看 gpujs/gpu.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。