Jump to content


Photo

OptiPNG file type plugin (November 30, 2008)


102 replies to this topic

#1 I Like Pi

I Like Pi
  • Members
  • 186 posts
  • Reputation:0

Posted 06 October 2007 - 10:59 PM

NOTE >> This plugin is incompatable with Paint.NET 4.0.  Use the more recent version found here: http://forums.getpai...showtopic=22841

 

This plugin integrates OptiPNG with Paint.NET. It optimizes PNG to make them smaller, which is good for web use.

Compiled DLL:
Attached File  OptiPNG plugin.zip   105.29KB   32324 downloads
Both the DLL and optipng.exe need to be in the FileTypes directory.

November 30 - updated to OptiPNG 0.62, some minor changes suggested by antond
October 24 - updated to OptiPNG 0.61, no changes in my code
June 20 - updated to OptiPNG 0.6, no changes in my code




Source Code:
License: GNU General Public License (GPL) v3
Attached File  Source Code.zip   119.65KB   2583 downloads


  • 0

#2 Myrddin

Myrddin

    Former Moderator

  • Members
  • 4,155 posts
  • LocationSheffield, England.
  • Reputation:2

Posted 06 October 2007 - 11:17 PM

Original - 57.2 KB
PNG_transparency_demonstration_1.png

OptiPNG file type plugin; RGB with alpha, compression 7 (basically the defaults which appeared) - 58.8 KB
PNG_transparency_demonstration_1 v2.png

(The black backgrounds are fully transparent).
  • 0

#3 Andrew D

Andrew D
  • Members
  • 2,238 posts
  • Reputation:0

Posted 06 October 2007 - 11:24 PM

Original - 57.2 KB
[attachment=1]PNG_transparency_demonstration_1.png[/attachment]

OptiPNG file type plugin; RGB with alpha, compression 7 (basically the defaults which appeared) - 58.8 KB
[attachment=0]PNG_transparency_demonstration_1 v2.png[/attachment]

(The black backgrounds are fully transparent).


Your kidding me, it makes it larger :?
  • 0

#4 I Like Pi

I Like Pi
  • Members
  • 186 posts
  • Reputation:0

Posted 06 October 2007 - 11:31 PM

Lots of Wikipedia's images are already optimized :wink:

17:58, 17 August 2007 JeffyP 320×240 57 KB revert
17:39, 17 August 2007 JeffyP 320×240 44 KB Compressed even further
08:03, 15 October 2005 Txuspe 320×240 57 KB Compressed with PNGOUT.
00:45, 12 July 2005 Daniel G. 320×240 62 KB 24bit PNG with 8bit alpha layer Rendered in POV-Ray by user:ed_g2s. See also: Image:PNG transparency demonstration 1.png {{GFDL}}


  • 0

#5 Fisherman's Friend

Fisherman's Friend
  • Members
  • 490 posts
  • LocationCoruscant
  • Reputation:1

Posted 06 October 2007 - 11:44 PM

Maybe we should do a little benchmark with new pictures.

Would be interesting to compare it with HD Photo, too.

I would do it, but I will not be here again until Monday, so please don't wait for me.

And thanks for the plugin, at least this is a good step.
  • 0

#6 Myrddin

Myrddin

    Former Moderator

  • Members
  • 4,155 posts
  • LocationSheffield, England.
  • Reputation:2

Posted 06 October 2007 - 11:49 PM

Fair comment I Like Pi...

Original - 33.7 KB
Posted Image

OptiPNG file type plugin; RGB with alpha, compression 7 - 26.1 KB
Posted Image

--------------------------------------------

Original - 651 KB
Posted Image
Click for larger

OptiPNG file type plugin; RGB, compression 7, transparency threshold 0 - 394 KB
Posted Image
Click for larger

Well done, it works! Thank you very much, this will save considerable time. The slow speed I'll attribute to OptiPNG as all the PNG optimisers I've tried are reasonably slow, however, is there anything you can do about speed, especially when dealing with larger images?
  • 0

#7 I Like Pi

I Like Pi
  • Members
  • 186 posts
  • Reputation:0

Posted 07 October 2007 - 01:04 AM

Small update:
[*:8d48b]Changed default optimization level to 2 because it's OptiPNG's default
[*:8d48b]Added some more tooltips
[*:8d48b]Interlacing on/off
In the future, I may expose more of OptiPNG's command line options so users who know what they're doing can eshew OptiPNG's preset levels (which basically brute force a bunch of settings for the smallest size).
Problem is I don't fully understand the options.
  • 0

#8 Mr Frojo

Mr Frojo
  • Members
  • 2,118 posts
  • LocationColorado
  • Reputation:2

Posted 07 October 2007 - 04:31 PM

Nice. This might be really usefull. Ive been using OptiPNG for a while now, and its great to see it integrated into Pdn.
  • 0

I'm still alive!


#9 Blooper

Blooper
  • Members
  • 2,102 posts
  • Reputation:0

Posted 08 October 2007 - 07:06 PM

Erm, it's an empty folder?
Posted Image
  • 0

#10 Bob

Bob
  • Members
  • 3,033 posts
  • LocationLyon, France
  • Reputation:3

Posted 08 October 2007 - 07:46 PM

Working here.
Just redownload.
  • 0

#11 david.atwell

david.atwell

    2013 Real Estate Award Winner

  • Moderators
  • 1,671 posts
  • LocationIndianapolis, IN (39°46′5.88″N 86°9′29.52″W)
  • Reputation:184

Posted 08 October 2007 - 09:15 PM

This is quite cool! I like it a lot, and it will certainly come in handy! Thanks!
  • 0

stargatesig.png

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.


#12 Fisherman's Friend

Fisherman's Friend
  • Members
  • 490 posts
  • LocationCoruscant
  • Reputation:1

Posted 08 October 2007 - 10:07 PM

In the future, I may expose more of OptiPNG's command line options so users who know what they're doing can eshew OptiPNG's preset levels (which basically brute force a bunch of settings for the smallest size).
Problem is I don't fully understand the options.


If possible, it would be very nice to see this brute force thing (PNGauntlet has something similar) available. If you have problems you could make a beta, I'm sure you would find a lot of "testers", and maybe this would be a help.
  • 0

#13 Blooper

Blooper
  • Members
  • 2,102 posts
  • Reputation:0

Posted 08 October 2007 - 10:21 PM

Ok, it works now. Thanks to you, and to Bob :D
  • 0

#14 I Like Pi

I Like Pi
  • Members
  • 186 posts
  • Reputation:0

Posted 08 October 2007 - 11:07 PM

If possible, it would be very nice to see this brute force thing (PNGauntlet has something similar) available. If you have problems you could make a beta, I'm sure you would find a lot of "testers", and maybe this would be a help.

It already uses brute force. The defaults tell OptiPNG to brute force a bunch of filters and stuff. (This is what the "x trials" means.)
From OptiPNG documentation (the -ox corresponds to what this plugin uses):
Optimization level presets:
    -o0  <=>  -nz
    -o1  <=>  [apply libpng heuristics]         (1 trial)
    -o2  <=>  -zc9 -zm8 -zs0-3 -f0,5            (8 trials)
    -o3  <=>  -zc9 -zm8-9 -zs0-3 -f0,5          (16 trials)
    -o4  <=>  -zc9 -zm8 -zs0-3 -f0-5            (24 trials)
    -o5  <=>  -zc9 -zm8-9 -zs0-3 -f0-5          (48 trials)
    -o6  <=>  -zc1-9 -zm8 -zs0-3 -f0-5          (120 trials)
    -o7  <=>  -zc1-9 -zm8-9 -zs0-3 -f0-5        (240 trials)
(If anyone wants to improve anything, feel free to download the source code.)
  • 0

#15 Fisherman's Friend

Fisherman's Friend
  • Members
  • 490 posts
  • LocationCoruscant
  • Reputation:1

Posted 09 October 2007 - 12:53 PM

It already uses brute force. The defaults tell OptiPNG to brute force a bunch of filters and stuff. (This is what the "x trials" means.)


I see. I thought brute force would mean that it automatically detects the best settings for the picture. When I use PNGauntlet it displays something like "image doesn't fit into 256 color space, try RGB instead". Maybe I'm wrong and this isn't what brute force actually means...? Well, the reason why I asked was that PNGauntlet produced in some tests I made in a bunch of cases files that were around 10 KB smaller, and I thought that would be related to this brute force stuff. Using the file type plugin, you can select many options (like grayscale, RGB with alpha and so on), and my idea was that I used bad settings and as a consequence I got better results with PNGauntlet cause it searched for the best settings... To be honest I haven't looked if the settings of the file type plugin are chosen automatically or if it remebers the previous settings...?

If someone wants to make tests with PNGauntlet (rather useless for 10 poor KB, I think), please note that the release I got came with an outdated version of pngout (the commandline exe which PNGauntlet uses) and I had to download the actual version seperately.

Another question: Can there be a checkbox to disable the preview? I don't know how much the speed impact actually would be...?
  • 0

#16 Rick Brewster

Rick Brewster

    Paint.NET Author and Developer

  • Administrators
  • 13,526 posts
  • LocationKirkland, WA
  • Reputation:324

Posted 09 October 2007 - 06:27 PM

The power of a PNG optimizer is best realized when optimizing many images. All the icons in Paint.NET v3.10 are optimized using OptiPNG and it cut down the installer size by 100k or so.
  • 0
The Paint.NET Blog: http://blog.getpaint.net/
Donations are always appreciated! http://www.getpaint.net/donate.html

Posted Image

#17 Fisherman's Friend

Fisherman's Friend
  • Members
  • 490 posts
  • LocationCoruscant
  • Reputation:1

Posted 09 October 2007 - 06:59 PM

By the way I realized that optimized pngs are best with screenshots (without wallpaper) and other similar pictures with sharp lines. When you have a complex picture like taken with a camera, HD Photo - surprise! - gives in a lot of cases better results (not ever, but in a test I did I got around 130 KB for an 500X350 picture with optimized png and 90 KB with HDP). Too bad I get no previews for HDPs running XP, I think Microsoft should release a shell extension for it, just that you get previews... You have no planes to make one in your free time, aren't you, Rick...? :roll:
(OK, this joke was rather bad...)
  • 0

#18 I Like Pi

I Like Pi
  • Members
  • 186 posts
  • Reputation:0

Posted 09 October 2007 - 09:20 PM

Brute force is trying out every possibility. Intelligently detecting optimal settings would be the opposite. http://en.wikipedia....iki/Brute_force
The plugin remembers the previous settings; this is done by Paint.NET.
PNGGauntlet has a brute force search option, but I don't know what it does by default.
The color options reduce the amount of color so that OptiPNG can do more optimization. I do not pass them as arguments to OptiPNG. If an image is already grayscale, for example, your color selection should not make a difference because OptiPNG should notice that the image fits in grayscale and make a grayscale PNG. However, if the image does not already fit in grayscale, OptiPNG will not reduce the image to grayscale.

Update 1.0.2:
[*:5cbde]Feature: preview checkbox
[*:5cbde]Efficiency improvement: don't optimize again when pressing OK if the last preview is identical.
  • 0

#19 Fisherman's Friend

Fisherman's Friend
  • Members
  • 490 posts
  • LocationCoruscant
  • Reputation:1

Posted 10 October 2007 - 11:36 AM

Thanks for the explanation and, of course, for the update.
  • 0

#20 kirby145

kirby145
  • Members
  • 133 posts
  • Reputation:2

Posted 11 October 2007 - 10:35 PM

This would mainly be useful for the whole "Pngs darker in ie" thing.
  • 0
"By trying to reinvent the wheel every time we find very often with square wheels" ...X-blaster