mirror of
https://github.com/CosmicScale/PSBBN-Definitive-English-Patch.git
synced 2025-01-26 03:35:30 +01:00
Improved artwork downloader and converter
This commit is contained in:
parent
11b8506a8c
commit
97bc4291cb
@ -502,15 +502,30 @@ if compgen -G "${input_dir}/*" > /dev/null; then
|
||||
base_name=$(basename "${file%.*}")
|
||||
|
||||
# Define output filename with .png extension
|
||||
output="${ARTWORK_DIR}/${base_name}.png"
|
||||
|
||||
# Convert each file to .png with resizing and 8-bit depth
|
||||
convert "$file" -resize 256x256! -depth 8 -alpha off "$output" | tee -a "${LOG_FILE}"
|
||||
output="${ARTWORK_DIR}/tmp/${base_name}.png"
|
||||
|
||||
# Get image dimensions using identify
|
||||
dimensions=$(identify -format "%w %h" "$file")
|
||||
width=$(echo "$dimensions" | cut -d' ' -f1)
|
||||
height=$(echo "$dimensions" | cut -d' ' -f2)
|
||||
|
||||
# Check if width >= 256 and height >= width
|
||||
if [[ $width -ge 256 && $height -ge $width ]]; then
|
||||
# Convert each file to .png with resizing and 8-bit depth
|
||||
echo "Converting $file"
|
||||
convert "$file" -resize 256x256^ -gravity center -extent 256x256 -depth 8 -alpha off "$output" | tee -a "${LOG_FILE}"
|
||||
rm "$file"
|
||||
else
|
||||
echo "Skipping $file: does not meet size requirements" | tee -a "${LOG_FILE}"
|
||||
rm "$file"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "No files to process in ${input_dir}" | tee -a "${LOG_FILE}"
|
||||
echo "No files to process in ${input_dir}" | tee -a "${LOG_FILE}"
|
||||
fi
|
||||
|
||||
cp ${ARTWORK_DIR}/tmp/* ${ARTWORK_DIR}
|
||||
|
||||
echo | tee -a "${LOG_FILE}"
|
||||
echo "Creating game assets..." | tee -a "${LOG_FILE}"
|
||||
|
||||
|
@ -87,7 +87,7 @@ const puppeteer = require('puppeteer'); // Import Puppeteer after ensuring it's
|
||||
const img = document.querySelector('img[src^="https://media.ign.com"]');
|
||||
|
||||
if (img) {
|
||||
return img.src;
|
||||
return img.src.split('?')[0]; // Remove query parameters
|
||||
}
|
||||
return null;
|
||||
});
|
||||
@ -101,7 +101,7 @@ const puppeteer = require('puppeteer'); // Import Puppeteer after ensuring it's
|
||||
const img = document.querySelector('img[src^="https://ps2media.ign.com"]');
|
||||
|
||||
if (img) {
|
||||
return img.src;
|
||||
return img.src.split('?')[0]; // Remove query parameters
|
||||
}
|
||||
return null;
|
||||
});
|
||||
@ -115,7 +115,7 @@ const puppeteer = require('puppeteer'); // Import Puppeteer after ensuring it's
|
||||
const img = document.querySelector('img[src^="https://ps3media.ign.com"]');
|
||||
|
||||
if (img) {
|
||||
return img.src;
|
||||
return img.src.split('?')[0]; // Remove query parameters
|
||||
}
|
||||
return null;
|
||||
});
|
||||
@ -143,7 +143,7 @@ const puppeteer = require('puppeteer'); // Import Puppeteer after ensuring it's
|
||||
const img = document.querySelector('img[src^="https://assets1.ignimgs.com"]');
|
||||
|
||||
if (img) {
|
||||
return img.src;
|
||||
return img.src.split('?')[0]; // Remove query parameters
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user