Last active
May 24, 2022 12:01
-
-
Save david-prv/236c7e44b23f5fa71e4c2819276c9b0e to your computer and use it in GitHub Desktop.
Simple script to generate ppm files from jpegs using 'imagemagick' and pacman package manager
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 for arguments | |
if [ $# -eq 0 ] | |
then | |
# no args passed | |
echo "Usage: ./convert_ppm.sh <input file> <output file>" | |
exit 1 | |
fi | |
# check for imagemagick dependency | |
pacman -Qi imagemagick > /dev/null | |
if [ $? -ne 0 ] | |
then | |
# missing dependency | |
echo "Missing dependency 'imagemagick'. Installing..." | |
sudo pacman -S imagemagick --noconfirm | |
fi | |
# converting | |
convert $1 -compress none -set comment \"\" $2 | |
sed -i '/^#/d' $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got some time and I have realized your suggestion for improvement :)