Page 1 of 1
Automated Media Center: Custom sized artwork
Posted: 24 Sep 2013, 20:01
by Clint
First I want to thank you for providing this amazing tool, my collection is has never been so clean and structured!
I'm running amc with semisuccess on my Zyxel NSA310 under Debian. I cannot for the life of me get the JNA/Libzen debacle to function properly but renaming, subtitles and artwork gets through so I'm happy! I do however have problems with the size of the fanart.jpg and poster.jpg beeing to big for my mediaplayer (Med8er MED400x mini) to accept them. Is it possible to pull down two sets of the artwork, where one is custom sized, or even only one set in custom sizes? I can't find any documents on that feature here.
Sizes I'm looking for to please my mediaplayer is:
poster.jpg = 158x237
fanart.jpg = 1280x720
Thank You!
Re: Automated Media Center: Custom sized artwork
Posted: 24 Sep 2013, 20:20
by rednoah
You could modify htpc.groovy and to pick the artwork u want, though it'll require lots of experimenting to get it working.
If I were you I'd run a batch resize script. I'm sure there's tools out there. Or use bash and some sort of find -exec imagemagick resize ...
Re: Automated Media Center: Custom sized artwork
Posted: 24 Sep 2013, 20:26
by Clint
rednoah wrote:You could modify htpc.groovy and to pick the artwork u want, though it'll require lots of experimenting to get it working.
If I were you I'd run a batch resize script. I'm sure there's tools out there. Or use bash and some sort of find -exec imagemagick resize ...
Thanks for the quick answer! Yes, I have been at the imagemagick tool but are stumbling on the loop technicalities... I thought I'd ask here first if there was anything established in that manner.

Re: Automated Media Center: Custom sized artwork
Posted: 24 Sep 2013, 20:50
by rednoah
If you manage to make convert work on a single image, u can combine it with find -exec to do it for all:
http://www.grymoire.com/Unix/Find.html#uh-13
Re: Automated Media Center: Custom sized artwork
Posted: 24 Sep 2013, 21:00
by Clint
Yup, have been at the find and exec for a while. Excellent page, Thanks!
Re: Automated Media Center: Custom sized artwork
Posted: 26 Sep 2013, 09:33
by Clint
I did a rudimentary script for my purposes, works fine for my needs. It runs through my media share and resize artwork if not already in defined size. It lacks a few bits and pieces but I'm not a *nix guru so maybe someone could throw in some knowledge here
Code: Select all
#!/bin/bash
# Set specifics for scraper/mediaplayer (MED400xmini)
# Poster
POSTER=158x237
# Fanart
FANART=1280x720
#FANART=1920x1080
MEDIA_DIR=/share/MEDIA
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
C=0;
cd $MEDIA_DIR
# Look for existing filebot generated artwork and resize them
for img in `find $MEDIA_DIR -maxdepth 5 -mindepth 1 -iname poster.jpg -type f`
do
(( ++C ));
if [[ "$(identify -format "%m:%f %wx%h" $img)" != "JPEG:poster.jpg $POSTER" ]];
then
echo "Resizing $img to $POSTER"
mogrify -resize $POSTER $img;
fi
done
for img in `find $MEDIA_DIR -maxdepth 5 -mindepth 1 -iname fanart.jpg -type f`
do
(( ++C ));
if [[ "$(identify -format "%m:%f %wx%h" $img)" != "JPEG:fanart.jpg $FANART" ]];
then
echo "Resizing $img to $FANART"
mogrify -resize $FANART $img;
fi
done
# restore $IFS
IFS=$SAVEIFS
Re: Automated Media Center: Custom sized artwork
Posted: 27 Sep 2013, 15:20
by Clint
After some testing I decided to take a new approach, the imagemagick "identify" isn't 100% consistent. I also had to rename the images so better make copies then to keep the high-res ones intact.
Code: Select all
#!/bin/bash
# Set specifics for scraper/mediaplayer (MED400xmini)
# Poster
FOLDER=158x237
# Fanart
ABOUT=1280x720
MEDIA_DIR=/share/MEDIA
find $MEDIA_DIR -type f -name 'poster.jpg' |
while read file; do
if [[ -e "$(dirname "$file")/folder.jpg" ]];
then
echo ""$(dirname "$file")/folder.jpg" already present, skipping!"
else
echo ""$(dirname "$file")/folder.jpg" not present, creating one!"
convert "$file" -resize $FOLDER "$(dirname "$file")/folder.jpg"
fi
done
find $MEDIA_DIR -type f -name 'fanart.jpg' |
while read file; do
if [[ -e "$(dirname "$file")/about.jpg" ]];
then
echo ""$(dirname "$file")/about.jpg" already present, skipping!"
else
echo ""$(dirname "$file")/about.jpg" not present, creating one!"
convert "$file" -resize $ABOUT "$(dirname "$file")/about.jpg"
fi
done