Please request registration email again and then check your "Spam" folder


Image compression/rename tools

Started by kenshuck, Oct 07, 2022, 09:36 PM

Previous topic - Next topic

kenshuckTopic starter

So as I was looking ways to compress images aside of online compressors, since the majority of them don't allow you to use entire folders, I runned into:
I found it pretty useful, since it allows you to just select a folder (like EventPictures) and it detects all the sub-folders and images. Then you select wich format you want it to convert, and it also provides an slider for quality (i.e.: you can reduce the image quality to, say, 80%, to reduce even more the file size). It also allows you to rename and give a secuential order to the images

Wich other batch conversion/compression tools you know/use?
Wich batch rename tool you use?
my mediafire carpet with all my mods


I use the tinypng photoshop plugin (because it's fast).
Shilo recently started using this
Some also recommend

For renaming I usually just shift+right click to open powershell and use
dir | rename-item -NewName {$ -replace "0_","2_"}to replace stuff in the current directory.  The replacement text supports regex, like "^0_" to replace only starting 0_'s.


Gimp also has a batch conversion plugin that works great.


I also use XnConvert for my batch image conversions. (Not that it's resulted in any contributions to HHS+, yet. But I have made image packs for other games, usually in the brothel sim format where each character is a stand alone pack with 100+ images.) And I'm a bit of a perfectionist. XnConvert is a very powerful tool that allows a user to operate on a folder of files all at once.

Example case:
I've made an image replacement mod for HHS+ using a bunch of high quality, non-censored images found on gelbooru. The files are structured in my Mod folder in the same way that files are structured in the NormalSchool folder. Same folder stucture and filename as the ones they are meant to replace.

There are two problems however.
1 Some of my files are .png .jpeg or .webp files, not .jpg as the files I'm replacing. Copying my mod onto the vanilla game won't sucessfully replace all images.
2 My folder is nearly 2GB in size. That is way to much for distributing with a game that asks for "small filesize in images, hosting is non-trivial"

I want XnConvert to convert all my images to the .jpg file format and give them the proper .jpg extension. Without having to bother with folders and subfolders. (There are a lot of those.  ;) )
And I want the files to end up at a reasonable size.

  • Input the folder into XnConvert's Input tab using drag and drop from windows. I just grab the root folder of my mod, no need to grab the images themselves. (Note that you can sort by the Column "Type" and group all, say .webp images and easily exclude them from the batch.)
  • Add a new action to the Actions tab: Action > Image > Resize. Preset: Custom, Mode: Fit, Resolution: 1920 by 1080, Make sure "Keep ratio" is ticked, set Enlarge/Reduce to Reduce Only
  • Select a folder to output the resulting images to. (Pick something that you can easily find outside of your HHS+ folder. To keep things simple) Make sure "Keep folder structure" and "Keep parent folder" are ticked. Set format to JPG and click settings to reduce or increase the targeted quality of images. 80% quality of JPG usually takes a losless image format output to half the file size of a 100% output, at very low cost to quality.
  • Click the Convert button at the bottom of the page.

180 Seconds later my i7 8700K (6cores @ 4.2GHz) and the source files and output folder both located on an old SATA HDD had chewed the images and shrunk 2GB to 173Mb.

All images with a width larger than 1920px or height larger than 1080px were resized to fit within that boundary, preserving their aspect ratio.
They are all .jpg and compressed to the 80% quality target.

I'm trying to demonstrate the power of the tool, and asume you wont use it for the same purpose as me. (As that would be redundant when my mod is finished and uploaded.) You should use it or a similar tool when you have found your images and made your own mod.

Ideally you don't output as .jpg but .webp when you make your own mod. The files are 10-25% smaller, and preserve detail better than the old JPG format. I'm replacing stuff in NormalSchool, not adding to it. Hence the .jpg.

Some aditional info regarding formats.

My initial comparison between .jpg and .webp were made using the images from my first session of work on this project to sate my curiosity.
82 images mostly .png were my source images. Coming in at 120Mb.
A quick convert to 80% .jpg and 90% .webp without the resizing bit reduced the size to 24.1Mb for JPG and 19.8Mb for WebP.
Adding the resizing step above to limit all image resolutions to 1080p (A sane resolution for HHS+) changed the results to 9.77Mb for JPG and 8.94Mb for WebP.
"4K" resolution limit yelded 18.0Mb for JPG and 15.5Mb for WebP.
And good old 800x600 (Not same aspect ratio, but a lot of images curently in NormalSchool are this resolution or lower) just as a sanity check for compression, yelded 4.15Mb for JPG and 3.93Mb for WebP.

One of the nice things about XnConvert is that you can create a profile and export it. Then it could be uploaded to this forum and serve as an official "your file must be this small to pass" standard.
You can set up parameters, so that it outputs everything as .webp, and targets X% quality, but only from losless files (and jpg/webp files with metadata saying they were compressed to target 100% quality) and 100% quality target from lossy files, to minimize the copy-of-copy effect amongs people who might not be to sharp on the quality of their source material. Just a thought.