Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/invoice_pdf/node_modules/@jimp/jpeg/test/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { Jimp, getTestDir } from "@jimp/test-utils";
import configure from "@jimp/custom";
import expect from "@storybook/expect";
import jpeg from "../src";
const jimp = configure({ types: [jpeg] }, Jimp);
describe("JPEG", () => {
const imagesDir = getTestDir(__dirname) + "/images";
it("load JPG", async () => {
const image = await jimp.read(imagesDir + "/cops.jpg");
expect(image.getPixelColor(10, 10)).toBe(0x3f4a02ff);
expect(image.getPixelColor(220, 190)).toBe(0x5d94b6ff);
expect(image.getPixelColor(350, 130)).toBe(0xdf7944ff);
});
it("load JPG with fill bytes", async () => {
const image = await jimp.read(imagesDir + "/fillbytes.jpg");
expect(image.getPixelColor(10, 10)).toBe(0xaeb8c3ff);
expect(image.getPixelColor(220, 190)).toBe(0x262b21ff);
expect(image.getPixelColor(350, 130)).toBe(0x4e5d30ff);
});
it("export JPG", async () => {
const image = await jimp.read({
width: 3,
height: 3,
data: [
0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
0xff00ffff, 0x8000ffff, 0x0000ffff,
],
});
image.quality(50);
const buffer = await image.getBufferAsync("image/jpeg");
expect(buffer.toString()).toMatch(/^.{3,9}JFIF\u0000/);
});
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0397 ]-- |