Fed-Kun's army
- Joined
- Dec 18, 2018
- Messages
- 63
Share your awesome scritps here bois. any scripting language should do,
even powershell. but if you do post powershell scripts ima point my fingers at you madly.
Rules:
1. be sure to provide a description of what scripting language is it and what it does.
3. in code; be sure to add comments of what it does.
4. no funny bussiness like encrypting code with base64 or im gonna whore to MD staff to ban your account.
5. be sure to keep it relevant, as long as it has something to do with manga/anime is fine I guess.
6. Add Spoiler Tag. see here
7. to avoid filling this thread with possible requests; another thread will be made
if this thread is helpful/active/interesing.
A Bash Script: will search folders recursively and change jpgs disguised as pngs to pngs and vice-versa then use cjxl to lossless encode all jpgs/pngs. if an image has a jpg/png extension then it will append (JPG).jxl or (PNG).jxl
This script werks just fine am not even a beginner and i feel proud.
if you can do better than me then quote me with a replacement.
even powershell. but if you do post powershell scripts ima point my fingers at you madly.
Rules:
1. be sure to provide a description of what scripting language is it and what it does.
3. in code; be sure to add comments of what it does.
4. no funny bussiness like encrypting code with base64 or im gonna whore to MD staff to ban your account.
5. be sure to keep it relevant, as long as it has something to do with manga/anime is fine I guess.
6. Add Spoiler Tag. see here
7. to avoid filling this thread with possible requests; another thread will be made
if this thread is helpful/active/interesing.
A Bash Script: will search folders recursively and change jpgs disguised as pngs to pngs and vice-versa then use cjxl to lossless encode all jpgs/pngs. if an image has a jpg/png extension then it will append (JPG).jxl or (PNG).jxl
Bash:
#!/bin/bash
shopt -s globstar # search folders recursively for .png files and changes them to .jpg if thats its correct file extension
for f in *[I]/[/I].png ; do
if [[ $(file -b --mime-type "$f") = image/jpeg ]] ; then
mv "$f" "${f/%.png/.jpg}"
fi
done
shopt -s globstar # same as above but for jpgs
for f in *[I]/[/I].jpg ; do
if [[ $(file -b --mime-type "$f") = image/png ]] ; then
mv "$f" "${f/%.jpg/.png}"
fi
done
shopt -s globstar # search folders recursively for pngs and encode them losslessly while appending (PNG) if it was a .png image
for f in *[I]/[/I].png; do
cjxl "$f" -d 0 --num_threads=4 "${f%.*} (PNG)".jxl
done
shopt -s globstar # same as above but for jpgs
for f in *[I]/[/I].jpg; do
cjxl "$f" -j 1 -d 0 -e 7 --num_threads=4 "${f%.*} (JPG)".jxl
done
if you can do better than me then quote me with a replacement.
Last edited: