Author Topic: The contraption 22: Forum file optimizer  (Read 5320 times)

Francois

  • Self-Coat
  • *****
  • Posts: 15,764
The contraption 22: Forum file optimizer
« on: September 20, 2015, 06:45:51 PM »
Here's a quick one for all those of you out there who are tired of manually resizing their files and playing with the compression ratio to get them to be the right size.
I did use irfanview in the past for that, but that means opening ans saving each files one by one. I did use BDsizer before also but somehow wanted something smaller with no buttons, you know, one of those one trick ponies where you just drag a folder and it does its job?
Well, I wrote a small script just for that. Just copy the text and save it as a .bat or .cmd file. You can tweak the settings as you want.
Be warned though: IT WILL OVERWRITE EVERY FILE WITH THE NEW SMALLER VERSION!

In order to be able to run this script, you have to install the ImageMagick command line tools.

Enjoy!
Quote
@ECHO OFF
rem change codepage to allow nice graphics ;-)
chcp 65001
CLS
rem Go to drag and drop folder
if "%~1" == "" exit
cd "%~1"

rem Get current dir name
for %%* in (.) do set CurrDirName=%%~n*
echo Forum JPG resizer
echo.
echo This program will resize any jpg to 800 pixels
echo wide or high and make a less than 200kb file.
echo this will overwrite all the files in %CurrDirName%
choice /m "Do you accept" /c YN
if errorlevel 2 goto end
if errorlevel 1 goto resize
goto end
:RESIZE
echo RESIZING
mogrify *.jpg -thumbnail 800x800 -define jpeg:extent=198kb *.jpg
echo Files resized
:END
echo thank you
pause
Francois

Film is the vinyl record of photography.

jojonas~

  • Self-Coat
  • *****
  • Posts: 2,928
  • back at 63° 49′ 32″ N
    • jojonas @ flickr
Re: The contraption 22: Forum file optimizer
« Reply #1 on: September 23, 2015, 11:53:59 AM »
oh, I'll have to try this! as mentioned before I use irfan mostly for this. I had Image resizer ( https://imageresizer.codeplex.com/ ) for a while. it was nice that you could just right click on a film and resize it from there. but the files coming out on the other side had a bit too much jpg compression for my taste.
/jonas

Francois

  • Self-Coat
  • *****
  • Posts: 15,764
Re: The contraption 22: Forum file optimizer
« Reply #2 on: September 23, 2015, 02:05:32 PM »
I tried it but I don't understand exactly how the program manages the compression ratios. I did notice that for some reasons sometimes the files come out smaller than expected. But for the size of the script, its worth trying.
Francois

Film is the vinyl record of photography.