Skip to content

Posts tagged ‘free’

20
Aug

How To Optimize PNG Images with TinyPNG

TinyPNG is a great service for optimizing and shrinking PNG files. I’ve been using it for several years now. I tried out as many apps, command line tools and services as I could find, and never found anything as easy to use or as high quality.

Most PNG images are created in a way that wastes a lot of space. TinyPNG discovers and removes this wasted space. I’ve found that most of my images are about twice as big as they need to be. And I don’t notice any visual differences after the optimization process. The differences are there, but they are almost impossible to notice unless you know what you’re looking for.

API

When I had only a few images, the website was perfect. Drag-and-drop up to 20 files at once, wait, click to download, done. However, as I added more images, it became a little tricky to keep track of them all.

About a year and a half ago, I started using their new developer API. Whenever I added or changed an image, I would put it in a folder with all my original images. I wrote a script to send all of the files to TinyPNG and then download the optimized versions into a separate folder.

Photoshop Plugin

TinyPNG has a Photoshop plugin too, but I’ve never used it.

Code

This is the script I wrote. It’s a command line tool that takes an input folder and an output folder. The optimized images end up in the output folder.

#!/usr/bin/ruby -w

#
# tinypng.rb — Placed into the public domain by Daniel Reese.
#

require 'rubygems'
require 'json'

# Set API key.
apikey = "your_api_key_goes_here"

# Verify arguments.
ARGV.length == 2 or fail("Usage: ./tinypng.rb <input-folder> <output-folder>")
src = ARGV[0]
dst = ARGV[1]
File.exist?(src) or fail("Input folder does not exist: " + src)
File.exist?(dst) or fail("Output folder does not exist: " + dst)

# Optimize each image in the source folder.
Dir.chdir(src)
Dir.glob('*.png') do |png_file|
    puts "\nOptimizing #{png_file}"

    # Optimize and deflate both images.
    cmd = "curl -u api:#{apikey} --data-binary @#{png_file} 'https://api.tinypng.com/shrink'"
    puts cmd
    r = JSON.parse `#{cmd}`
    if r['error']
        puts "TinyPNG Error: #{r['message']} (#{r['error']})"
        exit(1)
    end
    url = r['output']['url']
    cmd = "curl '#{url}' -o #{dst}/#{png_file}"
    puts cmd
    `#{cmd}`
end
Dir.chdir("..")

puts 'Done'

Recommended

The best part is that TinyPNG is free. If you are using the API and want to optimize more than 500 images a month, or if you are working with files larger than 5MB or so, then you’ll want to subscribe to one of their monthly plans. There are no commitments, so you can switch back to the free plan any time.

Overall, I highly recommend TinyPNG. They are continually tweaking things so that their service is always as good as it can be. The company that runs TinyPNG uses it themselves for their internal development projects. I think that may be why it works so well for developers.

If you want to save disk space and load time, especially for mobile apps, go check it out.

4
Apr

Free DNS Hosting Performance Tests

UPDATE May 2011: Namecheap’s DNS service has recently experienced two outages: one due to a denial of service attack and the other caused by a misconfigured DNS entry at another registrar. Their service is relatively new, so I hope they handle these types of issues better in the future. I appreciate the honesty and openness with which they have reported these issues. ClouDNS is also experiencing intermittent downtime, but has not mentioned anything.

UPDATE July 2013: A few months ago, I switched to using CloudFlare’s Free plan. I’m really happy with the service, which is faster than what I’ve been using before. And I really like using a company specializing in DNS security and performance. SolveDNS’s DNS Speed Comparison Report agrees. Highly recommended.

ORIGINAL

Way back in April 2009, I read two articles about using Pingdom to test hosted DNS services. Pingdom has a limited free account, includes several types of web-related performance tests and has test servers in over 25 locations throughout North America and Europe. I started using it immediately and have been very pleased with their product and service.

I’ve been wanting to test the performance of hosted DNS services that include at least one domain for free. Two years later, I finally got around to it. All tests were done with my own domain name.

Each test covered eight days (except Afraid, which I ended early after six). I would have preferred to run the tests concurrently over a longer period of time. If I missed anyone, please let me know and I’ll add them to the list.

NameUptimeResponseStd DevNotes
Namecheap100.00%82 ms175 msIncludes free email forwarding.
ClouDNS100.00%93 ms319 msExcellent user interface.
Moniker100.00%114 ms248 ms*** Included with domain registration. ***
ZoneEdit99.65%91 ms280 ms
GeoScaling99.78%103 ms332 ms
XName100.00%117 ms325 ms
DNS Exit99.98%256 ms1025 ms
FreeDNS100.00%187 ms530 msWebsite down for days recently. No comment on why.
Afraid80.45%223 ms1022 msSub-domain sharing. Down 4 mins every 19.

I recommend Namecheap and ClouDNS. If you are willing to pay for DNS services, there may be faster and more reliable options. I’d love to try out easyDNS and DynDNS but neither have a free option.

Here are the charts to give you a visual idea of the test results. Pingdom needs to allow customers to control the vertical scale. I’m just too lazy to make my own charts using their cool API. :)

Namecheap

Namecheap performance results

ClouDNS

ClouDNS performance results

Moniker

Moniker performance results

ZoneEdit

ZoneEdit performance results

GeoScaling

GeoScaling performance results

XName

XName performance results

DNS Exit

DNS Exit performance results

FreeDNS

FreeDNS performance results

Afraid

Afraid performance results