macneacail Posted July 15, 2019 Share Posted July 15, 2019 Paint.net 4.2 will not open bmp files created using Microsoft Drawing Routines. paint.NET has been opening these files since 2012 Application version: paint.net 4.2 PaintDotNet.Imaging.UnknownImageFormatException (0x88982F07): D:\src\pdn\src\SystemLayer.Native\Imaging\WICImagingFactory.cpp (892) : hr = spDecoder->Initialize( spStream, static_cast<WICDecodeOptions>(metadataOptions)); at PaintDotNet.Interop.InteropErrorInfo.ThrowIfError() in D:\src\pdn\src\Base\Interop\InteropErrorInfo.cs:line 98 at PaintDotNet.SystemLayer.Native.x64.NativeUtilities.ThrowOnErrorImpl(Int32 hr, SByte* szHr, IUnknown* pFxErrorInfo) at PaintDotNet.SystemLayer.Native.x64.Imaging.WICImagingFactory.CreateDecoderFromStream(Stream stream, BitmapDecodeOptions metadataOptions, Nullable`1 containerFormat, Nullable`1 preferredVendor) at PaintDotNet.Data.WicFileTypeHelpers.Load(Stream input, Nullable`1 forcedContainerFormat, Nullable`1 preferredVendor, MetadataTranscoder metadataTranscoder) in D:\src\pdn\src\PaintDotNet\Data\WicFileTypeHelpers.cs:line 61 at PaintDotNet.Data.BmpFileType.OnLoad(Stream input) in D:\src\pdn\src\PaintDotNet\Data\BmpFileType.cs:line 93 at PaintDotNet.FileType.Load(Stream input) in D:\src\pdn\src\Data\FileType.cs:line 482 at PaintDotNet.Functional.Func.Eval[T1,TRet](Func`2 f, T1 arg1) in D:\src\pdn\src\Base\Functional\Func.cs:line 158 Quote Link to comment Share on other sites More sharing options...
macneacail Posted July 15, 2019 Author Share Posted July 15, 2019 The bitmaps load with 4.1.6 - just reverted. I updated the drawing program to net4.8 - still had same error Quote Link to comment Share on other sites More sharing options...
macneacail Posted July 15, 2019 Author Share Posted July 15, 2019 These bitmaps load in Word, PowerPoint as well as paint Quote Link to comment Share on other sites More sharing options...
BoltBait Posted July 15, 2019 Share Posted July 15, 2019 2 hours ago, macneacail said: Paint.net 4.2 will not open bmp files created using Microsoft Drawing Routines. Please post a sample of one of these images. Thanks! EDIT: Since you say "Drawing Routines", I'm going to hazard a guess that the files you're talking about are actually WMF files and not BMP files. If you take a WMF file and rename it to BMP, Windows Paint (and Microsoft Word) will still open it just fine. Paint.NET can't do that. However, Paint.NET has a WMF filetype plugin that can load WMF files. You can find it here: https://forums.getpaint.net/topic/17950-wmf-windows-metafile-file-type-plugin-v131/ But, before attempting to open the file, if it has the extension BMP you'll need to change it to WMF. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
macneacail Posted July 15, 2019 Author Share Posted July 15, 2019 Thank you for the response. Each file is about 5 MB so it will not upload. Bitmap newBmp = new Bitmap(XL, Y, System.Drawing.Imaging.PixelFormat.Format24bppRgb); creates the file I wonder why does paint.net 4.1.6 open the files and paint.net has done so since I started using it in about 2012 John Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted July 15, 2019 Share Posted July 15, 2019 5 minutes ago, macneacail said: Bitmap newBmp = new Bitmap(XL, Y, System.Drawing.Imaging.PixelFormat.Format24bppRgb); When you save the file to disk, you need to specify the format. i.e. newBmp.Save(@"C:\image.bmp", System.Drawing.Imaging.ImageFormat.Bmp); If you just do this, it will save in the PNG format (regardless of the file extension) newBmp.Save(@"C:\image.bmp"); // Saves in the PNG format 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...
Rick Brewster Posted July 15, 2019 Share Posted July 15, 2019 1 hour ago, macneacail said: I wonder why does paint.net 4.1.6 open the files and paint.net has done so since I started using it in about 2012 Maybe read about it? A ton has changed under the hood. https://blog.getpaint.net/2019/07/13/paint-net-4-2-is-now-available/ And @toe_head2001 is right. The bug is in your code and file naming, not in Paint.NET. 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...
macneacail Posted July 15, 2019 Author Share Posted July 15, 2019 4 hours ago, Rick Brewster said: Maybe read about it? A ton has changed under the hood. https://blog.getpaint.net/2019/07/13/paint-net-4-2-is-now-available/ And @toe_head2001 is right. The bug is in your code and file naming, not in Paint.NET. Dear Rick: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- using (var inFile = File.OpenRead(NameofBitMap)) { var decoder = BitmapDecoder.Create(inFile, BitmapCreateOptions.None, BitmapCacheOption.None); var encoder = new PngBitmapEncoder(); var frame = decoder.Frames[0]; encoder.Frames.Add(frame); using (var outFile = File.OpenWrite(NameofBitMap + ".png")) { encoder.Save(outFile); } } ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- René Slijkhuis provides a simple workaround for the moment -- I prefer to think of bugs as unused features I read the blog content -- interesting Perhaps instead of breaking BMP images created using GDI that is still legal with the perversion that bmp is really PNG in some cases - maintaining the option or putting up a more descriptive error might have been useful. Renaming BMP to PNG worked. But rule number 101 from Computer Science 100 in 1978 - do not criticize other people's code, I always find is useful, although often ignored. As the great Jerry Pournelle once said "bend the punch cards - enjoy the day" RIP JP you are missed. Great program by the way. John Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted July 15, 2019 Share Posted July 15, 2019 Well, we found the solution at least ¯\_(ツ)_/¯ 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 July 16, 2019 Share Posted July 16, 2019 See also 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 July 31, 2019 Share Posted July 31, 2019 The beta should fix this: https://forums.getpaint.net/topic/114817-paintnet-421-beta-build-7151/ 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.