Jump to content

error saving a file, seems related to bit depth being at auto detect


Sey
 Share

Recommended Posts

unknown.png
^ this image here.
saving the image gives "there was an error while saving the file". details are

Quote

Exception:
System.ArgumentException: the maximum # of colors is 256
   at PaintDotNet.Imaging.PaletteTable..ctor(IEnumerable`1 colors) in D:\src\pdn\src_4_3_x\Framework\Imaging\PaletteTable.cs:line 44
   at PaintDotNet.Imaging.ImageColorsAnalysis.Create(IBitmapSource`1 source, ICancellationToken cancelToken) in D:\src\pdn\src_4_3_x\Framework\Imaging\ImageColorsAnalysis.cs:line 104
   at PaintDotNet.Imaging.ImageColorsAnalysis.Create(IRenderer`1 renderer, ICancellationToken cancelToken) in D:\src\pdn\src_4_3_x\Framework\Imaging\ImageColorsAnalysis.cs:line 27
   at PaintDotNet.Data.InternalFileType.OnSaveT(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) in D:\src\pdn\src_4_3_x\PaintDotNet\Data\InternalFileType.cs:line 111
   at PaintDotNet.FileType`2.OnSave(Document input, Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler callback) in D:\src\pdn\src_4_3_x\Data\FileType`2.cs:line 39
   at PaintDotNet.FileType.Save(Document input, Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler callback, Boolean rememberToken) in D:\src\pdn\src_4_3_x\Data\FileType.cs:line 261
   at PaintDotNet.Controls.DocumentWorkspace.<>c__DisplayClass248_1.<DoSaveImpl>b__7() in D:\src\pdn\src_4_3_x\PaintDotNet\Controls\DocumentWorkspace.cs:line 2784
   at PaintDotNet.Functional.Func.Try(Action f) in D:\src\pdn\src_4_3_x\Base\Functional\Func.cs:line 173

when setting bit depth to anything below 24 or having it on auto detect, the error occurs.
it originally happened when I was trying to save an image I got after resizing something, screenshotting the resize, resizing again, just messing around like that, I think I also used a brush a bit at one point.
originally I ran into it on 4.3.3, but occurs with the same image on 4.3.4 too.
the error doesn´t pop up when I just paste the image onto the standard white canvas and try to save that, cropping to the image and then trying to save it leads to the error again.
changing canvas width to 15 (from 14) makes it normally saveable again, also tried copying a portion of the image over the white that appeared from resizing the canvas, and that´s saveable too.
someone ran into a similar error here 

Link to comment
Share on other sites

Yup that repros for me ... super weird. I'll see about getting a fix in for 4.3.5.

 

This is happening because your image has 257 unique colors, and the last unique color is the very last (bottom-right) pixel in the image. My code apparently doesn't handle this corner* case. Before I release 4.3.5, you could work around this by setting the bottom-right pixel to the same color as any other pixel in the image. I'm not sure if that'll work for what you need to do, though. You could also just save as 24- or 32-bit.

 

* ha. ha. ha.

  • Haha 1
  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...