Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Getting wrong color when drawing large image

オープン
#707 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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
フォーク
663
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

gpujs/gpu.js のほかの issue

gpujs/gpu.js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。