Optimize Images for Web


Image optimization is great way to speed up your website. Even if you use resized images on your site, there are many kilobytes that can be shaved off using advanced image optimizers. There are many useful online services (JPEGmini, Kraken, etc) and website plugins/modules for this task, but here is a quick tip on how to do the same thing with DropIt.

By default DropIt itself can’t optimize any image of course. You need to use 3rd party applications for that, but DropIt is a great tool to automatize this process.

There are three types of images that need to be taken care of. I selected these command-line applications for each:

Don’t worry if you’re not familiar with command-line utilities, you only need to find the download links on these sites and extract them to the appropriate folders.

All these applications will be set up to optimize images without data loss (that is, losslessly). If you need lossy optimization, read the tools’ documentations on how to do that.

NirCmd

NirCmd is a nice command-line utility which will help us running commands without seeing flashing command prompt windows. This is optional but recommended unless you are big fan of flashing command prompts 🙂

Get it from here:
http://www.nirsoft.net/utils/nircmd.html

Set up applications

To keep it easy, create a directory in your DropIt folder named “_utils”. This is where the image optimizers will go, plus NirCmd.

Download and extract the applications into these folders:

  • _utils\gifsicle\gifsicle.exe
  • _utils\jpegtran\jpegtran.exe
  • _utils\OptiPNG\optipng.exe
  • _utils\nircmd\nircmd.exe

Create Dropit Profile

Create a new profile in DropIt and name it “Optimize_Images”.

Then make it active and open its Associations editor. Create a new association with these parameters:

  1. Name: jpegtran
  2. Rules: *.jpg;*.jpeg
  3. Action: Open With
  4. Destination Program:
    “_utils\nircmd\nircmd.exe” exec hide “_utils\jpegtran\jpegtran.exe” -copy none -optimize -progressive -outfile “%File%” “%File%”

This will be responsible for JPG files. Now repeat this to PNGs and GIFs by creating two more associations:

  1. Name: OptiPNG
  2. Rules: *.png
  3. Action: Open With
  4. Destination Program:
    “_utils\nircmd\nircmd.exe” exec hide “_utils\OptiPNG\optipng.exe” “%File%”
  1. Name: gifsicle
  2. Rules: *.gif
  3. Action: Open With
  4. Destination Program:
    “_utils\nircmd\nircmd.exe” exec hide “_utils\gifsicle\gifsicle.exe” “%File%” -o “%File%”

These command will overwrite your original images, so be careful.
If you would like to create optimized copies of the originals instead, use these commands (these will append “_optimized” to the filename):

“_utils\nircmd\nircmd.exe” exec hide “_utils\jpegtran\jpegtran.exe” -copy none -optimize -progressive -outfile “%ParentDir%\%FileName%_optimized.%FileExt%” “%File%”

“_utils\nircmd\nircmd.exe” exec hide “_utils\OptiPNG\optipng.exe” -out “%ParentDir%\%FileName%_optimized.%FileExt%” “%File%”

“_utils\nircmd\nircmd.exe” exec hide “_utils\gifsicle\gifsicle.exe” “%File%” -o “%ParentDir%\%FileName%_optimized.%FileExt%”

Important: it is highly recommended to check “Pause until opened file is closed” setting (click on the icon left to “4. Destination Program:” in the Associations Editor dialog). This will tell DropIt to process images one after another and not all at once.

That’s it, now you only need to drag-and-drop images or directories onto DropIt and your images will get optimized.

Of course you may tweak the command-line parameters to your likings.

Here you can download the DropIt profile.

Advertisements

One thought on “Optimize Images for Web

  1. Hello!

    Sorry for the slightly O/T post, but I just recently found your awesome program while looking for a way to automate some photo workflow stuff I was working on. It’s extremely flexible / awesome…better than anything I’ve found, really! However, I noticed one issue. I fed it some TIF files with “Date Taken” set to some mm/dd/yyyy hh:mm:ss in Windows, and yet for some reason when running a rule on these files to move them to subfolders based on the MonthNameTaken, DayTaken, and YearTaken, DropIt does not properly parse the date taken information, and the files end up in various “unknown” folders.

    Here’s a snippet from the log:

    2015-10-27 22:47:27 ===== Log Enabled =====
    2015-10-27 22:47:37 Monitored Folder: E:\Photos\Auto Import to Lightroom\Pano Renders
    2015-10-27 22:47:37 Total Size Loaded: 449 MB
    2015-10-27 22:47:37 Loaded: E:\Photos\Auto Import to Lightroom\Pano Renders\[Group 0]-_DSC2654__DSC2659-2 images_0000.tif
    2015-10-27 22:47:37 Moved: E:\Photos\Auto Import to Lightroom\To Import\Unknown YearTaken\Unknown MonthNameTaken\Unknown DayTaken\

    Here’s the image in question: http://1drv.ms/1jQdzAL

    Here’s a screenshot of the file properties: http://i.imgur.com/kbEs7J4.png

    Any chance you might be able to take a look? Feel free to ping me at ajamess (at) gmail.com if you want more info. I’d really like to use this for a key part of my photo workflow, but unfortunately, it’s not possible at the moment given the potential issue mentioned above.

    Thanks!

    Adam.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s