Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lovely-streets-write.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@imgproxy/imgproxy-js-core": patch
---

Add pdf and jxl to [format](https://docs.imgproxy.net/usage/processing#format) option
2 changes: 2 additions & 0 deletions src/options/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { guardIsUndef, guardIsValidVal } from "../utils";
const formatValues = {
png: true,
jpg: true,
jxl: true,
webp: true,
avif: true,
gif: true,
Expand All @@ -12,6 +13,7 @@ const formatValues = {
bmp: true,
tiff: true,
mp4: true,
pdf: true,
best: true,
};

Expand Down
1 change: 1 addition & 0 deletions src/options/skipProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { guardIsUndef, guardIsNotArray } from "../utils";

const extNames = [
"jpg",
"jxl",
"png",
"webp",
"avif",
Expand Down
4 changes: 4 additions & 0 deletions src/types/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* At the moment, imgproxy supports only the most popular image formats.
* - `png` — Portable Network Graphics
* - `jpg` — Joint Photographic Experts Group
* - `jxl` — JPEG XL
* - `webp` — WebP
* - `avif` — AV1 Image File Format
* - `gif` — Graphics Interchange Format
Expand All @@ -13,6 +14,7 @@
* - `bmp` — Bitmap
* - `tiff` — Tagged Image File Format
* - `mp4` — **PRO feature** MPEG-4
* - `pdf` — **PRO feature** PDF document
* - `best` — **PRO feature** to make imgproxy pick the best format for the
* resultant image. Check out the {@link https://docs.imgproxy.net/best_format | Best format guide}
* to learn more.
Expand All @@ -25,6 +27,7 @@
type Format =
| "png"
| "jpg"
| "jxl"
| "webp"
| "avif"
| "gif"
Expand All @@ -33,6 +36,7 @@ type Format =
| "bmp"
| "tiff"
| "mp4"
| "pdf"
| "best";

/**
Expand Down
1 change: 1 addition & 0 deletions src/types/skipProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
type SkipProcessing = Array<
| "jpg"
| "jxl"
| "png"
| "webp"
| "avif"
Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("format", () => {
it("should throw an error if format is invalid", () => {
// @ts-expect-error: Let's ignore an error (check for users with vanilla js).
expect(() => build({ format: "invalid" })).toThrow(
"format option is invalid. Valid values are: png, jpg, webp, avif, gif, ico, svg, bmp, tiff, mp4, best"
"format option is invalid. Valid values are: png, jpg, jxl, webp, avif, gif, ico, svg, bmp, tiff, mp4, pdf, best"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/skipProcessing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("skipProcessing", () => {
it("should throw an error if skipProcessing contains unsupported extensions", () => {
// @ts-expect-error: Let's ignore an error (check for users with vanilla js).
expect(() => build({ skip_processing: ["tiff", "jpeg"] })).toThrow(
"skip_processing option contains unsupported extension. Valid values are: jpg,png,webp,avif,gif,ico,svg,heic,bmp,tiff,pdf,mp4"
"skip_processing option contains unsupported extension. Valid values are: jpg,jxl,png,webp,avif,gif,ico,svg,heic,bmp,tiff,pdf,mp4"
);
});

Expand Down