drakbar Posted December 15, 2021 Share Posted December 15, 2021 So I am working on images for machine learning, and absolute pixels values matter. Somewhere between 250 x 250 pixels and 350 x 350 pixels small color values such as 010101 is rounded down to 000000. Steps to reproduce. Create an canvas of 350x350 pixels. Use the fill tool to make the entire canvas black (color value 000000). Use the color picker to verify that the canvas is 000000. Select the pencil tool. Change your primary color to 010101. Pencil the top left 3x3 pixels. Use the color picker to verify that those pixel are 010101 and the rest are 000000. Save the file. (as png) Close the file. Open the file. Use the color picker to verify the color in the top left corner. Expected Value: 010101 Observed Value: 000000 I am not sure what the issue is. My guess is that it has something to do with compression. This behavior hasn't been observed below 250x250 pixels. Also if you make the entire canvas the value 010101, save, close, and reopen then the value will be what is expected. I am pretty sure that the pixel value is changed in the during the process of saving. I have loaded the file programmatically using python and looked at the pixel values while the file was open in Paint.net just after the file was saved. The pixel values observed during that time were 000000. This would rule out the values being change during close or loading back the image into Paint.net. The reason I believe that it has to do with compression is that if the entire canvas is 010101 then saving, exiting, and loading the file doesn't change the pixel value. I am not sure if my save settings are wrong, but I would like to figure out how to save these file without losing the data. I am able to perform this function in MS Paint which hurts my soul very deeply because I love Paint.net. 1 Quote Link to comment Share on other sites More sharing options...
Solution toe_head2001 Posted December 15, 2021 Solution Share Posted December 15, 2021 Auto-detect Bit Depth is using 1-bit in this scenario. Use 24-bit or 32-bit, depending on your needs. Quote (June 9th, 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...
Rick Brewster Posted December 15, 2021 Share Posted December 15, 2021 @drakbar, Are you using the latest version of PDN? There was a bug in "Auto Detect" bit-depth that were fixed in v4.3. If you are using the latest version (currently v4.3.4), then I'll be sure to take a look at getting a fix in for v4.3.5. 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...
drakbar Posted December 15, 2021 Author Share Posted December 15, 2021 @Rick BrewsterI just updated to 4.3.4. The Auto Detect bug must still be there, because I had to save it using 32-bit field. Thanks for looking into the fix, I am just glad I have a working solution as of right now/ Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 26, 2021 Share Posted December 26, 2021 This appears to be a bug in WIC (Windows Imaging Component), the system library that handles the low-level saving and loading of many of Paint.NET's built-in image types. I may be able to work around this if I can detect the mistake and use a higher bit-depth ... 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...
Rick Brewster Posted December 26, 2021 Share Posted December 26, 2021 Okay I have a fix for this. WIC's format converter for 8-bit to <8-bit is buggy. I already had my own converter for 8-bit to 4-bit, and I was able to easily adapt it to handle 2-bit and 1-bit. 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...
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.