[ all / blog / incel / meta / music / random / tech / tv / vidya ]

/tech/

Thread #103

File: jeevacation.jpg (36 KB, jpg)
Image Gen Tools and Tricks. Anonymous No.103
Image gen like stable-diffusion.cpp embeds generation text and parameters into a tEXt field, but png is big and uses a lot of space, sometimes you want them batch converted to jpeg.

but naive convert from imagemagick/graphicsmagick fails to preserve the image gen parameters, in a way that other image tools can use

this does that
-------------------------------------
for f in *.png; do
out="${f%.png}.jpg"
exiftool -b -parameters "$f" > /tmp/params.txt 2>/dev/null
convert "$f" -quality 92 "$out"
exiftool -UserComment="$(</tmp/params.txt)" "$out" >/dev/null
done
---------------------------------------------------------
cheers, have a handmaiden