Guide Make images smaller without any quality loss (85% smaller!)

fang

Tier 3 Sub
Mar 11, 2022
30
308
542
0fya082315al84db03fa9bf467e3.png
**WARNING**: This guide is for more advanced users as this guide uses linux!

Hello my fellow hoarders. Most of your data is useless metadata.


Example:

As an example i downloaded all the Sayathefox (https://simpcity.su/index.php?threads/saya-the-fox.10438/) sets. ~3.8GB in size all together. Remove ONLY the metadata (things that don't impact image quality) shrunk the size down to 610MB!! More than 3GB of storage space wasted with useless trash data. (this data is useless as long as you don't use metadata to sort images)

Removing Metadata with MAT2​


Every .jpg image has a ton of metadata that are, in my cases, more than half of the filesize!

To remove this useless trash from your files get mat2 (
Please, Log in or Register to see links and images
).

To clean the metadata of a file you can do the following commands. I recommend the --inplace argument so that the file gets overwritten by the optimized version.

Bash:
Please, Log in or Register to view codes content!

An example with a picture of Megumi Koneko:


Bash:
Please, Log in or Register to view codes content!

The metadata of the file was close to 90% of the whole filesize! And the image quality was NOT touched by this operation!


Reduce image filesize further with optimization​


To install the following tools use

Bash:
Please, Log in or Register to view codes content!

Please note: Optimization is not equal to compression!

To optimize .jpg images use

Bash:
Please, Log in or Register to view codes content!

To optimize png images use

Bash:
Please, Log in or Register to view codes content!

The parameters are:

Bash:
Please, Log in or Register to view codes content!

To recursively do this for a folder or all folders use the same asterisks * as above with jpegoptim.

A bit of theory: PNG shouldn't be used for cosplay shooting pictures. They make the filesize huge and are more suited for other usecases than photography.
You can use imagemagick's `mogrify` command to convert PNG images to JPG without much quality loss.

Bash:
Please, Log in or Register to view codes content!

An example with a picture of SayaTheFox:

Bash:
Please, Log in or Register to view codes content!

The example above was, at first as a .png, 104MB (!) in size, but after converting it and removing metadata it was a nice 6.5MB.

Ofcourse you could say "I want to keep the high quality of my .png image", but, atleast for me, the huge storage space wasted is not worth the small amount of quality gained.


Closing examples​


A picture of Megumi Koneko as a full example (from 8.5 to 1.3MB!)

Bash:
Please, Log in or Register to view codes content!


Sayathefox all cyberdrop sets currently on this site (From 3.8GB to 553MB!)

Bash:
Please, Log in or Register to view codes content!
 

gtaporn

Floater in the Bathwater
Mar 14, 2022
420
4,153
1,218
0fya082315al84db03fa9bf467e3.png
Eh JPEG meta data's usually not that big. They're probably embeding tracking data or hiding encrypted information in images.
 
  • Like
Reactions: DrFreeman

ihateem

Bathwater Drinker
Mar 11, 2022
45
3,312
1,242
0fya082315al84db03fa9bf467e3.png
Please, Log in or Register to view quotes
Quick Guide:
1.) Install python (
Please, Log in or Register to see links and images
)
2.) Make sure during the install you check the box that says something like add to $PATH
3.) Copy + paste the script below into a new file and save it as whatever you like (e.g. exifremover.py). Make sure you save it as a .py file
4.) Run this command in cmd
Code:
Please, Log in or Register to view codes content!
5.) change directory to where the script is located (cd <directory>) and type the scripts name or use the absolute path (e.g. C:\Users\<user>\Desktop\exifremover.py). Pasting this into the cmd will execute the script and it should be easy to figure out from there

Python:
Please, Log in or Register to view codes content!
 
Last edited:

glizzygladiator

the glizzy man
Mar 11, 2022
332
17,566
1,408
0fya082315al84db03fa9bf467e3.png
Please, Log in or Register to view quotes
hmm doesnt work for me it says core not found lol but i struggle everytime with python stuff..

i found this website / programm
Please, Log in or Register to see links and images

its easy to use and seems like it gets used from photographers and such.
ive tried some folders but didnt safe more space than like 1MB soo idk :KEKWlaugh:
 

Anon_Aus

🦘🦘🦘
Mar 12, 2022
513
30,040
1,742
0fya082315al84db03fa9bf467e3.png
Please, Log in or Register to view quotes

Hey is it possible to be able to allow the script to be used with arguments? as in "exifremover.py [Directory] or a way to give it the top directory and let it work its way through subfolders to get images? Just wish for a way to be more automated, as I have 1700+ folders/subfolders to go through!

love the work, by the way! saving some space! :MLADY:
 
Last edited:

Anon_Aus

🦘🦘🦘
Mar 12, 2022
513
30,040
1,742
0fya082315al84db03fa9bf467e3.png
Well, I'm running it right now!
only seeing errors regarding...

  • `cannot identify image file 'G:\\*******\\*******\\********_source.mp4` most probably due to it being a video file and not an image file.
  • cannot write mode RGBA as JPEG I have no clue what that even means.
  • [Errno 13] Permission denied: 'G:\\******\\*******\\Posts' Most probably due to it being a folder with no images and/or its trying to remove the EXIF off of the folder itself?
Other than that looks like it's running smoothly!
 

ihateem

Bathwater Drinker
Mar 11, 2022
45
3,312
1,242
0fya082315al84db03fa9bf467e3.png
Please, Log in or Register to view quotes
If you mean to start the script then yea putting quotes around the path will execute the script (e.g. "C:\Users\<user>\Desktop\space here\exifremover.py"), if you mean in the script itself that shouldn't be an error but if it is let me know what its saying.
 

Anon_Aus

🦘🦘🦘
Mar 12, 2022
513
30,040
1,742
0fya082315al84db03fa9bf467e3.png
Please, Log in or Register to view quotes
I know we are asking for a lot! :pauseChamp:
But, is it possible to make a database of files already done? so when you run it on a directory it can skip already done files, or would that be too much to implement? Only because the script errored while I was at work due to a renamed folder... (my bad :MEGALUL:) and now i have to start all over again.

again, great script, cheers!!! :peepoClap:
 
  • Like
Reactions: jokaxoj768

Anon_Aus

🦘🦘🦘
Mar 12, 2022
513
30,040
1,742
0fya082315al84db03fa9bf467e3.png
got this error...
I'm assuming it's a special character of some sort in a filename?


Python:
Please, Log in or Register to view codes content!

Also, I re-ran the script and it skipped all files till the error, so I'm guessing the completed list seems to be working!
 

Anon_Aus

🦘🦘🦘
Mar 12, 2022
513
30,040
1,742
0fya082315al84db03fa9bf467e3.png
Ran it... Completed fine!

Just ran it again and it skipped already completed files, and only scanned newly added files!

Supurb :MLADY:
 
  • Like
Reactions: ihateem