frio Posted April 7, 2021 Share Posted April 7, 2021 (edited) This can be reproduced as follows: make a transparent image and paint on it with < 256 colors without antialiasing, ensuring 1-bit transparency depth. If there is partial transparency or the number of colors is sufficiently high, this exception does not occur. Attached is an image that's been saved as 32-bit, trying to resave it as autodetect fails. Exception: System.ArgumentException: palette colors must be opaque (A=255), although 1 transparent color as the last entry is permitted at PaintDotNet.Imaging.PaletteMap..ctor(IEnumerable`1 colors) in D:\src\pdn\src\Framework\Imaging\PaletteMap.cs:line 27 at PaintDotNet.Imaging.ProximityPaletteMap..ctor(IEnumerable`1 palette) in D:\src\pdn\src\Framework\Imaging\ProximityPaletteMap.cs:line 46 at PaintDotNet.Data.WicFileTypeHelpers.Save(IBitmapSource`1 sourceBgra32, Vector2Double dpi, Metadata metadata, Stream output, ContainerFormat containerFormat, Nullable`1 preferredVendor, IMetadataTranscoder metadataTranscoder, IEnumerable`1 encoderOptions, SavableBitDepths bitDepth, IReadOnlyList`1 paletteForIndexed, Int32 ditherLevelForIndexed, ProgressEventHandler progressCallback, Object progressCallbackSender) in D:\src\pdn\src\PaintDotNet\Data\WicFileTypeHelpers.cs:line 290 at PaintDotNet.Data.PngFileType.OnFinalSave(Document input, Stream output, Surface flattenedImage, SavableBitDepths bitDepth, IReadOnlyList`1 paletteColors, Int32 ditherLevel, PropertyBasedSaveConfigToken token, ProgressEventHandler progressCallback) in D:\src\pdn\src\PaintDotNet\Data\PngFileType.cs:line 263 at PaintDotNet.Data.InternalFileType.FinalSave(Document input, Stream output, Surface scratchSurface, SavableBitDepths bitDepth, QuantizationAlgorithm quantizationAlgorithm, Int32 alphaThreshold, Int32 ditherLevel, ImageColorsAnalysis analysis, PropertyBasedSaveConfigToken token, ProgressEventHandler progressCallback, Double progressStart, Double progressEnd) in D:\src\pdn\src\PaintDotNet\Data\InternalFileType.cs:line 510 at PaintDotNet.Data.InternalFileType.GetSavableBitDepthFileLength(SavableBitDepths bitDepth, Document input, Surface scratchSurface, QuantizationAlgorithm quantizationAlgorithm, Int32 ditherLevel, Int32 alphaThreshold, PropertyBasedSaveConfigToken token, ProgressEventHandler progressCallback, Double progressStart, Double progressEnd) in D:\src\pdn\src\PaintDotNet\Data\InternalFileType.cs:line 454 at PaintDotNet.Data.InternalFileType.ChooseBitDepth(Document input, Surface scratchSurface, QuantizationAlgorithm quantizationAlgorithm, Int32 ditherLevel, Int32 alphaThreshold, PropertyBasedSaveConfigToken token, ProgressEventHandler progressCallback, Double progressStart, Double progressEnd, HashSet`1 allowedBitDepths, HashSet`1 losslessBitDepths, ImageColorsAnalysis analysis) in D:\src\pdn\src\PaintDotNet\Data\InternalFileType.cs:line 346 at PaintDotNet.Data.InternalFileType.OnSaveT(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) in D:\src\pdn\src\PaintDotNet\Data\InternalFileType.cs:line 167 at PaintDotNet.FileType.Save(Document input, Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler callback, Boolean rememberToken) in D:\src\pdn\src\Data\FileType.cs:line 261 at PaintDotNet.Dialogs.SaveConfigDialog.<>c__DisplayClass49_0.<UpdatePreviewAsync>b__0() in D:\src\pdn\src\PaintDotNet\Dialogs\SaveConfigDialog.cs:line 613 at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at PaintDotNet.Dialogs.SaveConfigDialog.<UpdatePreviewAsync>d__49.MoveNext() in D:\src\pdn\src\PaintDotNet\Dialogs\SaveConfigDialog.cs:line 632 Edited April 7, 2021 by frio added image that reproduces the bug 2 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted April 7, 2021 Share Posted April 7, 2021 Aha, this is easy for me to reproduce, thanks! I'll get it fixed asap. Looks like the same issue reported by @HopperElec over here, https://forums.getpaint.net/topic/118070-paintnet-4216-beta-build-7765/?do=findComment&comment=582506, but their sample image didn't reproduce this for me. 2 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
HopperElec Posted April 8, 2021 Share Posted April 8, 2021 Ah yes, I was also not using anti-aliasing and was not using transparency so this is likely the same issue Quote Link to comment Share on other sites More sharing options...
HopperElec Posted April 12, 2021 Share Posted April 12, 2021 Is there any temporary solutions? Like, is there a way to edit the file having issues to remove what is causing the issue (like fix the bit depth), or is there a way to downgrade pdn temporarily to the version I didn't have this issue in? Quote Link to comment Share on other sites More sharing options...
ardneh Posted April 12, 2021 Share Posted April 12, 2021 You can download v4.2.15 here: https://www.getpaint.net/download.html Quote Link to comment Share on other sites More sharing options...
HopperElec Posted April 12, 2021 Share Posted April 12, 2021 Surely that's the version I'm already using, which is the one with this bug I'm trying to avoid? Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted April 12, 2021 Share Posted April 12, 2021 @HopperElec, Do you not realize you've been using a beta release of v4.2.16? Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
HopperElec Posted April 12, 2021 Share Posted April 12, 2021 Oh no I didn't sorry Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted April 12, 2021 Share Posted April 12, 2021 Try the new 4.2.16 build that I just put out: 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
frio Posted April 15, 2021 Author Share Posted April 15, 2021 Tested, saves the files it used to previously stumble on with autodetect. Thanks! (And I have to take this opportunity to add: thanks for all these ~15 years paint.net has been an indispensable tool for my purposes, over all kinds of Photoshops and what have you.) 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.