Created
April 19, 2023 12:53
-
-
Save JLeine/65e50d3f4fc246eca6ea35cc2aa7ebb5 to your computer and use it in GitHub Desktop.
Convert all drawio Files into PNGs and embedded the diagram into it
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
#!/bin/bash | |
# check if the directory path is provided | |
if [[ $# -eq 0 ]] | |
then | |
echo "Usage: $0 <directory_path>" | |
exit 1 | |
fi | |
# set the path to the drawio command line tool | |
DRAWIO_CLI=/Applications/draw.io.app/Contents/MacOS/draw.io | |
# loop through all files in the specified directory and its subfolders | |
find "$1" -type f -name "*.drawio" | while read file | |
do | |
# generate the name of the output PNG file | |
output="${file%.drawio}.drawio.png" | |
# use the drawio command line tool to convert the file | |
$DRAWIO_CLI -x -f png -e -o $output "$file" | |
# print a message indicating that the conversion is complete | |
echo "Converted $file to $output" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment