Thursday, August 26, 2010

Mass shrinking pictures in Windows (should be doable on Linux/Mac)

I've had this nagging problem of posting pictures to my website, but since my account there isn't unlimited, I have to reduce my picture sizes. I used to manually resize pictures based on if they had people, were important, etc: now I just excise the bad ones and post wholesale; however, I cannot digitally afford to continue this practice. I did some digging and came up with a basic solution that should mass-convert my images for hosting without noticeably bastardizing their quality.

1. jpegtran : copy the EXE to somewhere in your system path (a tools or Windows folder even)

2. ImageMagick: I installed the x64 16-bit DLL version & added it to my system path.

3. Batch file called "jpeg.bat" I put where I saved jpegtran...
FOR /R . %%G IN (*.jpg) DO jpegtran -optimize -copy all %%G %%G
FOR /R . %%G IN (*.jpg) DO convert -auto-orient -quality 85 %%G %%G
FOR /R . %%G IN (*.jpg) DO jpegtran -optimize -progressive -copy all %%G %%G
4. Use "cmd" in Start-Run or Windows-R: "cd"  to where your pictures are saved, and run "jpeg". Go do something else while you wait.

 Additional References

* Tutorial on changing your system path (if you need it)
* JPEG on Wikipedia
* "FOR /R" reference

No comments:

Post a Comment