Try running pngout and/or pngcrush on them.
Thanks for the reply. Is pngout / pngcrush similar to tinypng, or is it a component that I can install and run using the CF code?
Thanks for the reply. Is pngout / pngcrush similar to tinypng, or is it a
component that I can install and run using the CF code?
Both are compiled programs that you can run with CFEXECUTE from ColdFusion.
ahh. got it, so I can install and use command line to run them using CFEXECUTE, it's many years since I've done anything like this in the past, I'll play around and see if I can figure it out.
(I did try pngcrush on their site and received a slight saving so it was not as good as tinypng)
pngcrush uses an API, and I need it to always be running on my server, pngout I might be able to CFEXECUTE, BUT both of them give poor reduction results, I've emailed pngout to see if the developer has any ideas. tinypng is MUCH better but it's an API only setup
They do, but they charge for the number of images and I'm going to have a LOT of images to process, on top of that I don't want to have to rely on a 3rd party, I want the whole process to take place on my server
They do, but they charge for the number of images and I'm going to
have a LOT of images to process, on top of that I don't want to have
to rely on a 3rd party, I want the whole process to take place on my
In that case I think pngout or pngcrush are your best options.
It looked like pingcrush was also API running on their server only.
I managed to get 20% compression on pingout, compared to 75% on tinypng
I did receive a reply from pngout
"The landing page for tinypng states that it is lossy: it dithers (aka quantizes) the image.
PNGOUT never dithers. "
It looks like pngcrush does the same thing because like pngout, the savings on file size are not that great. I'll dig into it a little more to see if there is an option to apply a dither
GraphicsMagick has some PNG options... I wrote a custom tag to use on ColdFusion 8-11. GM supports 88 format and provides safer & faster manipulations. (It works with CMYK JPGs without compatibility or HEAP issues):
If you use GraphicsMagick, you'll be able to tweak the optimization settings too and generate thumbnails for an entire sub-directory with a single call.
Here's an article from SmashingMagazine regarding good compression settings for ImageMagick (similar to GraphicsMagick):
I'm also working on using ColdFusion with ExifTool. Using ImageRead() to determine if an image is CMYK has caused us a lot of performance problems. (80 seconds versus 300-500ms.)
It looks like I have a solution.
Looking at their site it appeared that they have different ways to test their software with links to third parties who use their software, one of them being http://www.tinyPNG.org , as you'll see in my thread above I wanted to produce the same excellent results of tinypng.
I downloaded the pngquant command line version for Windows and used CFEXECUTE to run it, it was super easy -->
<cfexecute name = "d:\pngquant.exe"
arguments = "d:\232.png --ext .png --force --speed 5"
outputFile = ""
timeout = "60">
In order for it not to create a new file but overwrite the original, I added --ext .png , otherwise you end up with two images
I noticed I could get it to run around twice as fast with -- speed 5, and still get the same amazing results, dropping 20k images down to around 5k, with no obvious drop in visual quality, if you go for -- speed 11, the fastest it can be a lot quicker, but the file sizes although still much smaller are not at their smallest.
The only argument I did have trouble with was -- skip-if-larger which is supposed to skip creation of the image if the results of the new image are actually larger than the original, however when I tried it I found that the new image would not create even though it would indeed be smaller (I've emailed them regarding this problem)
Ardfry did suggest that I then run the image through their lossless pngout to gain further on file size reduction, the tests I did with this did help, but only by around 2% or so.
This does appear to be a good clean solution, that is reasonably quick so I'll make this as the correct answer.
Thanks for your input.