Jump to content

otuncelli

Members
  • Posts

    292
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by otuncelli

  1. Updated to v0.0.0.2 (alpha) Changelog: Fixed a compatibility issue on α Paint.NET 4.3.3 Updated to use Chromium/Pdfium 98.0.4706.0 A lot of minor tweaks and bug fixes.
  2. The previous version (v1.05) is incompatible with Paint.NET α 4.3.3 due to PaintDotNet.VisualStyling.ThemeConfig class is now seems to be marked as internal. Updated to 1.05.1 Changelog: Removed the theme support since it causes crash on Paint.NET α 4.3.3.
  3. So I wrote an AutoIt script to automate open-close Settings->Tools window a few hundred times with 100 ms intervals. After fresh start and constantly opening-closing tools window and then Ctrl+Alt+Shift+~. This is the result. The number seems increasing and abnormally high. Ignore the path name btw, it still shows 4.3.1. But I just emptied that folder and copied portable alpha 4.3.3's files into it. AutoIt Script: #include <Constants.au3> Run("E:\Downloads\paint.net.4.3.1.portable.x64\paintdotnet.exe") $title = "Untitled - paint.net 4.3.3 (α 4.303.7988.35971)" WinWaitActive($title) AutoItSetOption("SendKeyDelay", 50) $i = 0 Do WinActivate($title) Send("!x") if ($i == 0) then WinActivate($title) Send("{Down}") endif $i += 1 WinActivate($title) Send("{ESCAPE}") Until $i = 1000
  4. The plugin only allows you to import SVG files into Paint.NET by rasterizing them. It doesn't allow you to work with vectors directly. No plugin can do this. The ShapeMaker plugin as close as you can get to vectors in Paint.NET.
  5. It seems "fixed" now 😂 I mean, that plugin was old (7 years), it broke the rules so it shouldn't have been published on this forum. But, with all that shimming and compatibility patches, it was working fine so far. I have a suggestion. Maybe Paint.NET can allow to bypass plugin blacklist with a switch similar to /disablePlugins (maybe /allowUnsafePlugins ? ). So anyone who using them or maybe dependant on them can continue to use them on new PDN releases with being aware of the consequences (may crash, behave differently etc...).
  6. This might be due to a bug in Paint.NET which will be fixed in the upcoming release.
  7. The installer for this plugin pack doesn't seem to support Store version unfortunately. I recommend BoltBait's plugin pack.
  8. Here is a workaround. The plugin should include System.Management.dll. You can get it from here: https://nuget.info/packages/System.Management/5.0.0 Double Click on runtimes->win->lib->netcoreapp2.0->System.Management.dll Put this DLL in the same folder as other plugin' files. It should work if you're using the plugin from the first page. But if you're using this one, it'll crash if you click on the "Menu". Because it links to OptionBasedLibrary v0.8.dll which is not qualified for shimming by Paint.NET. Maybe @Rick Brewster can do something about this for the upcoming Paint.NET release? Exception details: System.TypeLoadException: Could not load type 'System.Windows.Forms.ContextMenu' from assembly 'System.Windows.Forms, Version=5.0.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at ControlExtensions.ControlSplitButton.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
  9. After I've learned about the hotkey trick I too can't say there is a leak here on 4.3.2. I'll check this again on 4.3.3.
  10. Updated to v1.05 Changelog: Fixed a potential OverflowException. Updated to use SVG.NET v3.3.0. Added theme support.
  11. This is an old version. The plugin from the first page doesn't have this. It seems to be fixed with this commit back in 2017. It seems like the author forgot to update the version. https://github.com/simmetric/Paint.NET-Plugins/commit/eae99971de632354c7e59a80d1da7a0c611fbbcb#diff-f86412165b4b252938e93080785c780a1fa18e4f12405844c74df3f263019f5fL26 Yep, they'll need to publish it first though 🤪 You don't have to mark effect class itself. Yes, it doesn't load if I mark the class as Obsolete. But marking the constructor, methods etc... individually worked in my tests.
  12. This references panel just shows what you manually reference in csproj file. Actual references for the resulting assembly may be different than those you manually set. Compiler search and strips unused assembly references automatically. Yes, this method became obsolete and the author needs to change this to Surface.Fill instead of Surface.Clear. This is a different problem though. You should be able to suppress this error and compile the plugin by marking the methods, constructors and other stuff as Obsolete that are calling Obsolete API of Paint.NET. But keep in mind, this is just for testing, you shouldn't release a plugin that uses Obsolete methods. Paint.NET is keeping them just for old plugins (like this one) to not break. [Obsolete] protected override void OnRender(Rectangle[] renderRects, int startIndex, int length)
  13. Yes, It references SystemLayer DLL in project file but it doesn't seem to utilize it. https://github.com/simmetric/Paint.NET-Plugins/search?q=SystemLayer When I look with ILSpy, it doesn't show me.
  14. This keyboard combination seems to be based on key-code instead of character-code. So "tilde" equivalent must be this key on Finnish keyboard layout. Generally the key below Esc.
  15. I think he meant the assembly that DllImports are happening. I too think that'd be more appropriate place but I'm merging all managed dependencies. In this case, I think it'd better choice to put the resolver code in main assembly. For example, I might have other native library dependencies that are in different paths. If each dependency sets resolver for their own DllImports, after I merge, it'd be throwing InvalidOperationException. From MSDN: Only one resolver can be registered per assembly. Trying to register a second resolver fails with an InvalidOperationException.
  16. I couldn't manage to do this either. Native library references in .deps.json file is not respected. I'd like to know if its possible. There is DllImportResolver class (under System.Runtime.InteropServices namespace) in .NET 5 that can be useful. I don't know if it'll have any side-effects on other things though. If I'm intending to publish the plugin, can I use it? @Rick Brewster I won't use this code, this was just a test and it worked for me. Because, this specific plugin, unlike Magick.NET, all the native libraries for each platform are in the same directory as managed one and they're getting found automatically. But I might need to use this (or something similar) in another project. This code also contains older method that works for Paint.NET 4.2. static PdfFileType() { SetDllSearchPath(); } /// <exception cref="PlatformNotSupportedException"></exception> private static void SetDllSearchPath() { string lookupPath; if (RuntimeInformation.ProcessArchitecture == Architecture.X86) { lookupPath = @"runtimes/win-x86/native"; } else if (RuntimeInformation.ProcessArchitecture == Architecture.X64) { lookupPath = @"runtimes/win-x64/native"; } else if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64) { lookupPath = @"runtimes/win-arm64/native"; } else { throw new PlatformNotSupportedException(); } lookupPath = Path.Combine(Path.GetDirectoryName(typeof(PdfFileType).Assembly.Location), lookupPath); #if NET5_0_OR_GREATER IntPtr ResolveCallback(string libraryName, System.Reflection.Assembly assembly, DllImportSearchPath? path) { if (assembly != typeof(PdfFileType).Assembly) { return IntPtr.Zero; } NativeLibrary.TryLoad(Path.Combine(lookupPath, Path.GetFileNameWithoutExtension(libraryName) + ".dll"), out IntPtr handle); return handle; } DllImportResolver resolver = new DllImportResolver(ResolveCallback); NativeLibrary.SetDllImportResolver(typeof(PdfFileType).Assembly, resolver); #else SetDllDirectory(lookupPath); #endif } #endregion #if !NET5_0_OR_GREATER [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)] static extern bool SetDllDirectory(string lpPathName); #endif
  17. Interestingly, this panel doesn't show me .NET Core SDKs. It just says .NET SDK. I can only see them at Apps & features panel. From there, I uninstalled them without any problem.
  18. It's fine. You can safely remove those. Support for Framework until version 4.6.1 will end on April 2022 anyway. https://devblogs.microsoft.com/dotnet/net-framework-4-5-2-4-6-4-6-1-will-reach-end-of-support-on-april-26-2022/ .NET Core until v3.0 has already ended. https://dotnet.microsoft.com/platform/support/policy/dotnet-core I'm going to do that now as well.
  19. Agreed @Ego Eram Reputo. @MarijaM You can reach me with PM.
  20. I'm thinking of implementing something similar for my SVG File Type plugin for Paint.NET. It's currently load-only plugin. Raster to vector is a bit complex 😅 There is a --fillcolor option for potrace that you can use. (The codes below uses this) I also optimized the procedure. These codes are single step. They should do what you want from start to finish. This works but it generates squiggly lines due to upscaling algorithm. These codes are for .bat file. I also updated the link. @echo off SET /p MAGICKDIR="ImageMagick Directory (Default: C:\Program Files\ImageMagick-7.1.0-Q16-HDRI): " || SET "MAGICKDIR=C:\Program Files\ImageMagick-7.1.0-Q16-HDRI" SET /p POTRACEDIR="PoTrace Directory (Default: Current directory)" || SET "POTRACEDIR=%cd%" SET /p INPUT_DIR="Input Directory: " SET /p OUTPUT_DIR="Output Directory: " @echo on FOR %%a IN ("%INPUT_DIR%\*.png") DO ("%MAGICKDIR%\magick.exe" convert "%%~a" ^ -background white ^ -gravity center ^ -extent 105%%x105%% ^ -fill white ^ -draw "color %POINT% floodfill" ^ -trim ^ -filter box ^ -resize 1000x1000 ^ -type grayscale ^ pnm:- | %POTRACEDIR%\potrace.exe -b svg --fillcolor #ffffff -r 32 -s -o "%OUTPUT_DIR%\%%~na.svg") @echo "Done!" @echo off PAUSE This will perform AI upscaling before vectorization process. (If source image is so small) But it requires a good GPU and this program https://github.com/xinntao/Real-ESRGAN/releases/tag/v0.2.2.4. Also it takes more time to convert. @echo off SET /p MAGICKDIR="ImageMagick Directory (Default: C:\Program Files\ImageMagick-7.1.0-Q16-HDRI): " || SET "MAGICKDIR=C:\Program Files\ImageMagick-7.1.0-Q16-HDRI" SET /p RESRGAN="Real-ESRGAN Directory (Default: Current directory): " || SET "RESRGAN=%cd%" SET /p POTRACEDIR="PoTrace Directory (Default: Current directory): " || SET "POTRACEDIR=%cd%" SET /p INPUT_DIR="Input Directory: " SET /p OUTPUT_DIR="Output Directory: " @echo on FOR %%a IN ("%INPUT_DIR%\*.png") DO ("%MAGICKDIR%\magick.exe" convert "%%~a" ^ -background white ^ -trim ^ -type grayscale ^ png:"%OUTPUT_DIR%\out.png" "%RESRGAN%\realesrgan-ncnn-vulkan.exe" -s 4 -n realesrgan-x4plus-anime -i "%OUTPUT_DIR%\out.png" -o "%OUTPUT_DIR%\upscaled.png" "%MAGICKDIR%\magick.exe" convert "%OUTPUT_DIR%\upscaled.png" ^ -resize 800x800 ^ -type grayscale ^ pnm:- | "%POTRACEDIR%\potrace.exe" -b svg --fillcolor #ffffff -r 25.6 -s -o "%OUTPUT_DIR%\%%~na.svg" del "%OUTPUT_DIR%\out.png" && del "%OUTPUT_DIR%\upscaled.png") @echo "Done!" @echo off PAUSE And there is an alternative tool for potrace named "autotrace" which supports centerline tracing. It might give you better result than potrace so you may completely skip AI upscaling step if you use it with correct parameters. But I don't know much details. Here are the results: svgfiles.zip
  21. I'm happy it worked for your case 😊 Yes, it can resize using many many different techniques. There is interpolative resizing with different modes, scaling and adaptive-resizing options. I don't know which will work best with image tracing. The example code below using "box" filter. Also converts the resulting image to 300ppi. I've also updated the link. @echo off SET /p TOLERANCE="Tolerance (Default: 20): " || SET "TOLERANCE=20" SET /p MAGICKDIR="ImageMagick Directory (Default: C:\Program Files\ImageMagick-7.1.0-Q16-HDRI): " || SET "MAGICKDIR=C:\Program Files\ImageMagick-7.1.0-Q16-HDRI" SET /p POINT="Pick Color Point (Default: 0,0): " || SET "POINT=0,0" SET /p INPUT_DIR="Input Directory: " SET /p OUTPUT_DIR="Output Directory: " @echo on FOR %%a IN (%INPUT_DIR%\*.png) DO "%MAGICKDIR%\magick.exe" convert "%%~a" ^ -background white ^ -gravity center ^ -extent 105%%x105%% ^ -fuzz %TOLERANCE%%% ^ -fill transparent ^ -draw "color %POINT% floodfill" ^ -trim ^ -units PixelsPerInch ^ -density 300 ^ -filter box ^ -resize 3000x3000 ^ -background transparent ^ -gravity center ^ -extent 3000x3000 ^ "%OUTPUT_DIR%\%%~nxa" @echo "Done!" @echo off PAUSE Thanks to ImageMagick developers. Photoshop's batch processing is so limited compared to it, and it's there mainly for marketing. I'm glad this forum is not as strict as Photoshop's. So we can talk about other tools and suggest alternative ways to achive something.
  22. Yes, I fixed it. You can use the same link to get it. It'll now first extend the canvas size by 5 percent.
  23. I've to admit this is a bit technical since there is not much user interface. I'll try to explain as simple as I can. After installing ImageMagick, you don't need to run anything in it. This program doesn't work that way. It has no user interface at all. Just note the location where its installed on your computer. In my case it was in C:\Program Files\ImageMagick-7.1.0-Q16-HDRI. Then download this file anywhere on your computer and run it (Basically, this is the .bat file that contains the same code above): https://drive.google.com/file/d/1xKbX9CiTdBeUz53nECjyruruNSSiy8nM/view?usp=sharing It'll ask you to enter 5 parameters. For the first 3 parameters I'm using the defaults. So I skipped those just by pressing enter key. If you installed ImageMagick into another directory than mine, you'll need to enter its path here. Then I enter input and output directories. After that, It should start to generate images in output directory. Their backgrounds are removed and cropped.
  24. -trim command should do the trick. Here is the updated code. @echo off SET /p TOLERANCE="Tolerance (Default: 20): " || SET "TOLERANCE=20" SET /p MAGICKDIR="ImageMagick Directory (Default: C:\Program Files\ImageMagick-7.1.0-Q16-HDRI): " || SET "MAGICKDIR=C:\Program Files\ImageMagick-7.1.0-Q16-HDRI" SET /p POINT="Pick Color Point (Default: 0,0): " || SET "POINT=0,0" SET /p INPUT_DIR="Input Directory: " SET /p OUTPUT_DIR="Output Directory: " @echo on FOR %%a IN (%INPUT_DIR%\*.png) DO "%MAGICKDIR%\magick.exe" convert "%%~a" -fuzz %TOLERANCE%%% -fill transparent -draw "color %POINT% floodfill" -trim "%OUTPUT_DIR%\%%~nxa" @echo "Done!" PAUSE
×
×
  • Create New...