TaxPack v1.0.0 - Gmail Receipt Auto-Extractor & Tax Report Generator
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// Generate simple placeholder icons for TaxPack
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const zlib = require('zlib');
|
||||
|
||||
function createSimplePNG(size, r, g, b) {
|
||||
const width = size;
|
||||
const height = size;
|
||||
|
||||
const signature = Buffer.from([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]);
|
||||
|
||||
const ihdrData = Buffer.alloc(13);
|
||||
ihdrData.writeUInt32BE(width, 0);
|
||||
ihdrData.writeUInt32BE(height, 4);
|
||||
ihdrData[8] = 8;
|
||||
ihdrData[9] = 2;
|
||||
ihdrData[10] = 0;
|
||||
ihdrData[11] = 0;
|
||||
ihdrData[12] = 0;
|
||||
|
||||
const ihdr = createChunk('IHDR', ihdrData);
|
||||
|
||||
const rowSize = 1 + width * 3;
|
||||
const imageData = Buffer.alloc(height * rowSize);
|
||||
for (let y = 0; y < height; y++) {
|
||||
imageData[y * rowSize] = 0;
|
||||
for (let x = 0; x < width; x++) {
|
||||
const idx = y * rowSize + 1 + x * 3;
|
||||
imageData[idx] = r;
|
||||
imageData[idx + 1] = g;
|
||||
imageData[idx + 2] = b;
|
||||
}
|
||||
}
|
||||
|
||||
const compressed = zlib.deflateSync(imageData);
|
||||
const idat = createChunk('IDAT', compressed);
|
||||
const iend = createChunk('IEND', Buffer.alloc(0));
|
||||
|
||||
return Buffer.concat([signature, ihdr, idat, iend]);
|
||||
}
|
||||
|
||||
function createChunk(type, data) {
|
||||
const length = Buffer.alloc(4);
|
||||
length.writeUInt32BE(data.length, 0);
|
||||
const typeBuf = Buffer.from(type, 'ascii');
|
||||
const crc = zlib.crc32(Buffer.concat([typeBuf, data]));
|
||||
const crcBuf = Buffer.alloc(4);
|
||||
crcBuf.writeUInt32BE(crc >>> 0, 0);
|
||||
return Buffer.concat([length, typeBuf, data, crcBuf]);
|
||||
}
|
||||
|
||||
const iconsDir = path.join(__dirname, 'public', 'icons');
|
||||
fs.mkdirSync(iconsDir, { recursive: true });
|
||||
|
||||
const purple = { r: 107, g: 99, b: 182 };
|
||||
|
||||
[16, 48, 128].forEach(size => {
|
||||
const png = createSimplePNG(size, purple.r, purple.g, purple.b);
|
||||
fs.writeFileSync(path.join(iconsDir, `icon${size}.png`), png);
|
||||
console.log(`Created icon${size}.png`);
|
||||
});
|
||||
|
||||
console.log('Icons generated successfully');
|
||||
Reference in New Issue
Block a user