I am writing my thesis but due to the quantity and quality of images, the pass comes out at 26MB. The platform where I have to upload my document only allows me up to 5MB, so I need to compress my file. I have tried it with some external program but it leaves my graphics too horrible. I also read a way to do it with GhostScript, but I really don't understand how to do it. I know there are several posts on this topic but I would be infinitely grateful if someone could tell me step by step how to do it. I'm using MikTex on my computer.
Following @Skillmon's suggestion:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{graphicscache}
\begin{document}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{image.png}
\end{figure}
\end{document}
I got an error but at that moment I put this (trying to use shell-escape):

I know I'm wrong but based on this I think my question is a bit more concrete (I'm using Miktex on Windows)
graphicscachepackage might be helpful for the automatic downscaling to the desired DPI of your document. – Skillmon Jan 23 '22 at 17:46graphicscacheon which you can find the documentation. I suggest you read that and if you have specific problems regarding it you ask specific questions, that'll be faster and better than me reading the documentation of a package (I've never used myself) for you and trying to show some usage examples. If you come up with a working setup using the package (or not) you could then write a self-answer here for future visitors. – Skillmon Jan 23 '22 at 17:54graphicscacheby default uses 300 DPI, if that's bigger than what's required by that platform you could save even more (obviously at the expense of quality). – Skillmon Jan 23 '22 at 19:20