Last active
May 6, 2020 07:56
-
-
Save DevSusu/73b05ff91ccd6e249ab379501e717eb9 to your computer and use it in GitHub Desktop.
Batch png to jpg Compress and Convert
This file contains hidden or 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
find . -type f -name "*.png" -exec basename {} .png ';' | while read -r line ; do | |
$(convert $line.png pnm:- | mozcjpeg -quality 80 > jpg/$line.jpg) | |
done | |
find . -type f -name "*.png" -exec basename {} .png ';' | while read -r line ; do | |
$(convert $line.png -background white -alpha remove -alpha off pnm:- | mozcjpeg -quality 80 > jpg/$line.jpg) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mac OS 에서
Terminal(터미널)
App을 열어 아래와 같이 명령어를 입력해주세요.<some_version>은
brew install mozjpeg
명령 후 설치된 버전을 보고 입력해주셔야 합니다.위 작업까지 완료되면,
convert_png2jpg.sh.zip
파일을 다운로드해서 jpg가 들어있는 폴더 안에 압축을 풀어줍니다.jpg 라는 폴더를 만들어 줍니다.
해당 폴더에서 상단 Finder -> Services -> New Terminal at Folder 을 찾아서 눌러줍니다 (한글일 경우 다를 수 있습니다)
다시 열린
Terminal(터미널)
앱에 다음과 같이 입력하면 잠시 후jpg
폴더에 작업이 완료됩니다.감사합니다