Jump to content

OptiPNG file type plugin (November 30, 2008)


I Like Pi

Recommended Posts

(zero coding skills required with the forms designer in VS express)

I have NEGATIVE coding skillz. :-)

As with me. ;)

Edit:

You can choose between Compression methods 'Optimize' or 'Interlace', or both.

Interlace is provided by OptiPNG, so if OptiPNG doesn't run, I can't do interlacing.

Heh, that proves it. As long as it has nothing to do with Web stuff, I'm lost. ;)

Link to post
Share on other sites
  • 5 weeks later...

Okay, resurrection, but I feel it to be necessary not just for me, but also others.

I have recently realised that I have lost the newer version of OptiPNG, I've only got the working version before this one, unfortunately, the circumstance involving this whole 'attachment quota' deal seems to have removed all attachments from this topic (?! (not sure if this has happened elsewhere, or if it's just me)), I am therefore unable to download the most recent version. Does anyone have a copy to host somewhere, please?

Many thanks.

Link to post
Share on other sites
  • 2 months later...

You know, neither do I.

Strangely enough, I Like Pi, I have no problems on this new computer. Seeing as I use it (the new PC) almost exclusively now, I'm not going to worry about the other computer.

Anyway, as an example, a spacescape of mine - 1000x1000px - went from 943KB, to 709KB. And it opens at my bidding.

You're a hero. ;)

Link to post
Share on other sites
  • 6 months later...

I Like Pi, I downloaded OptiPNG Plugin.zip [104.55 KB] and do not see optipng.exe

after extracting from the zip file. I see the .dll and looks like a type of "read me" which

when I try to open it, it just flashes some text and is gone.

Would you give me direction.

Link to post
Share on other sites
...when I try to open it, it just flashes some text and is gone.
Perhaps this is what's going wrong.

You do not open the DLL as you would like any conventional file, you extract the contents of the ZIP into the FileTypes directory, found (by default) here: C:\Program Files\Paint.NET\FileTypes.

You then restart Paint.NET where you will then find OptiPNG in Save's file type drop-down menu.

Link to post
Share on other sites

Myrddin thanks for helping me. I'm glad to learn where to look for OptiPNG file type and I don't see

this file type in my drop down menu. I extracted the ZIP file onto my desktop and dragged it into my "File Type Folder"

in PDN. The following is what I have in the folder. VISTA likes to put everything into a folder it seems.

Is this what I should have? and direct me to what I should have/do.

PDNFileTypeFolder.jpg

Link to post
Share on other sites

Thanks, I Like Pi, I had the Optimizer file type in my drop down menu and

didn't recognize it....dumb me !! Tried some pictures with .png, and seeing that I'm not

able to do much with the resizing plugin. One picture was 400x435, saved with the Optimized PNG (*.png),

reloaded it and nothing had changed. Could you give a brief explanation/tut of steps to follow? Or would it

be to involved? Also, sometimes in the "Save Configuration" panel, I get "Preview, file size: [error]".

Link to post
Share on other sites
  • 3 weeks later...

I want ot submit a patch.

To get rid of annoying window, appearing each time you change some settings, or saving file,

change lines 92—95 of OptiPngFileType.cs

from

      StartInfo = {
                           Arguments = "\"" + tempFile + "\"" + " -o" + token.Compression + " -i" + (token.Interlace ? "1" : "0"),
                           WindowStyle = ProcessWindowStyle.Minimized
                       }

to

                        StartInfo = {
                           UseShellExecute = false,
                           CreateNoWindow = true,
                           Arguments = "\"" + tempFile + "\"" + " -o" + token.Compression + " -i" + (token.Interlace ? "1" : "0")
                       }

Link to post
Share on other sites

P.S.:

the best way to find a path to the “optipng.exe” executable is to find a path to currentAssembly.

Besause on my work machine I have no access to HKLM registry, so no path is stored there, and sometimes current directory is changed.

Also, I recomment to use string.Format method to create an argument string.

To sum up, lines 90-107 of OptiPngFileType.cs should be changed from

if (token.Optimize) {
   Process optimize = new Process {
       StartInfo = {
           Arguments = "\"" + tempFile + "\"" + " -o" + token.Compression + " -i" + (token.Interlace ? "1" : "0"),
           WindowStyle = ProcessWindowStyle.Minimized
       }
   };
   string startDir;
   try {
       startDir = (string)Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Paint.NET").GetValue("TARGETDIR");
   } catch (NullReferenceException) {
       startDir = Environment.CurrentDirectory;
   }
   optimize.StartInfo.FileName = Path.Combine(Path.Combine(startDir, "FileTypes"), "optipng.exe");
   optimize.Start();
   optimize.WaitForExit();
   optimize.Dispose();
}

to

if (token.Optimize) {
   Process optimize = new Process {
       StartInfo = {
           UseShellExecute = false,
           CreateNoWindow = true,
           Arguments = string.Format("\"{0}\" -o{1} -i{2}", tempFile, token.Compression, token.Interlace ? "1" : "0")
       }
   };
   string startDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
   optimize.StartInfo.FileName = Path.Combine(startDir, "optipng.exe");
   optimize.Start();
   optimize.WaitForExit();
   optimize.Dispose();
}

btw, reference to Microsoft.Win32 can be thrown away now.

Link to post
Share on other sites
  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

Guest
This topic is now closed to further replies.
×
×
  • Create New...