Investigate how to manipulate the cards into a 3x3 grid programmatically #110
Owner
No description provided.
AS a user, I want the inventory command to show my cards in a grid of images #79
type
spike
label
30 minutes 23 seconds
Author
Owner
```js
const { createCanvas, loadImage } = require('canvas');
const { writeFileSync } = require('fs');
async function test(gridSize) {
const totalImages = gridSize ** 2;
const imageWidth = 526;
const imageHeight = 712;
const canvasWidth = imageWidth * gridSize;
const canvasHeight = imageHeight * Math.floor(totalImages / gridSize);
const canvas = createCanvas(canvasWidth, canvasHeight);
const ctx = canvas.getContext('2d');
const images = [];
for (let i = 0; i < totalImages; i++) {
images.push(await loadImage(`cards/${i}.png`));
}
for (let i = 0; i < images.length; i++) {
const image = images[i];
const x = i % gridSize;
const y = Math.floor(i / gridSize);
const imageX = imageWidth * x;
const imageY = imageHeight * y;
ctx.drawImage(image, imageX, imageY);
writeFileSync("out.png", canvas.toBuffer());
}
}
test(3);
```
Labels
No labels
blocked
duplicate
needs criteria
needs estimate
needs tests
question
requires documentation
type
admin
type
alert
type
bug
type
change
type
defect
type
dependencies
type
epic
type
spike
type
story
type
subtask
won't fix
No project
No assignees
1 participant
Notifications
Total time spent: 30 minutes 23 seconds
Due date
Vylpes
30 minutes 23 seconds
No due date set.
Dependencies
No dependencies set.
Reference: External/card-drop#110
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?