We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Ms Paint Says This is not valid bitmap

Hii Team
I am converting A image to different file format but some of the file not open in MS Paint Showing error "This is not valid BITMAP File , or its format not correctly Supported "(Attached in screen shot ) by below Code
Most file the file supported but this file not open in Paint

try (Image image = Image.load(FPath)) {
// create an instance of JpegOptions
JpegOptions options = new JpegOptions();
// save bmp as jpeg

		image.save(FOUT, options);
	}catch (Exception e) {
	catch (Error e) {

I converted JFIF to ppm,
1.odg(https://lh4.googleusercontent.com/OUw7EwVtyQZYmGBcOvZWcLKXOfrLHbuBtB4zA5SfropyOoZlZ8GCbtlgpUusLZji8lT1M-5yQ6EfuBYUPWY2ZsUXIqjDzH-GkRa1kxUkafQ_jncpXlDBXcT39qk44VUB2TKm16DegA) ,

  1. ppm (https://lh6.googleusercontent.com/-Zkpp009KW4AH_48tcHgMpbnj516zcauL9h_L2ohZIj7c4PxXrfZ2FFb4g4Ecs8cFPgpCcettFL-U0K_QUWCjGQh2_mOfGobH1iMxMoEF3d1JOytQpj_UiIRavXwbklJNZYVZHicug)
  2. DICOM(https://lh5.googleusercontent.com/CJ3i1B808Mv0wom7APp-3qwsu1X1xfcxmYnLHPTAoPZIw53t1zEI7fNagEj4mMz_hdRGa3wIulh3qFwtXKdr1SkuL3U1KKQZuULmmi9rCMD0m3J4cPfhhA1BOVjwK9LXLWdszQcRfg)
    And Some Other .
    I attached input file and a output file(ppm) .https://drive.google.com/file/d/1lfMWIFi7BA6f0BE0ZzQGhwnFRoF8DTkV/view?usp=sharing

Please suggest how to fix this is not valid BITMAP file .

Hello @David_jack
As I can see in your java code, you convert a file (FPath) into jpeg. In this case If FOut file has an extension “.bmp” then MS Paint will not open it as it is not a bmp but jpeg. Just change the extension of output file in “.jpeg” and MS Paint will open it correctly.
Please, let me know if my response helps you.

@evgsidenko I tried but same issue occurs please check again and suggest me.
I checked many options like JpegOptions,BmpOptions,PngOptions but got same issue (only change in size output file have too much size .)
I want to tell one more thing this come only above attached file, not for to other file format with same extension.

Maybe there is a misunderstanding… but we do not support exporting to ppm, otg.

Furthermore, MS Paint can not work with ppm files