-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from ssciwr/webp
Use webp format for images
- Loading branch information
Showing
15 changed files
with
81 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ jobs: | |
with: | ||
node-version: 22 | ||
cache: "pnpm" | ||
- run: sudo apt-get update -yy && sudo apt-get install -yy webp | ||
- run: pnpm install | ||
- run: pnpm run build | ||
- uses: JamesIves/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
import fs from "fs"; | ||
import ConvertTiff from "tiff-to-png"; | ||
import { glob } from "glob"; | ||
import shell from "shelljs"; | ||
import path from "path"; | ||
import { execSync } from "child_process"; | ||
|
||
const image_dir = "./dist/fileadmin/templates/iwr_vis"; | ||
const image_dir = "./dist/fileadmin/templates/iwr_vis/"; | ||
fs.mkdirSync(image_dir, { recursive: true }); | ||
|
||
// convert tif images to png & write to dist/fileadmin/iwr_vis folder | ||
const tifImageFiles = await glob("**/img/*.tif"); | ||
const converter = new ConvertTiff(); | ||
converter.convertArray(tifImageFiles, image_dir).then(console.log); | ||
// convert all image files to webp & write to image folder | ||
const images = await glob("**/img/*.*"); | ||
|
||
// just copy any jpg or png images to image_dir | ||
shell.cp("./src/img/*.jpg", image_dir); | ||
shell.cp("./src/img/*.jpeg", image_dir); | ||
shell.cp("./src/img/*.png", image_dir); | ||
for (const image of images) { | ||
const output = path.format({ | ||
root: image_dir, | ||
name: path.parse(image).name, | ||
ext: ".webp", | ||
}); | ||
console.log(`${image} --> ${output}`); | ||
execSync(`cwebp ${image} -o ${output} -quiet`); | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.