BMP file converts into "slush"

  1. The file to convert is attached (Please rename it from .avi to .bmp) (Why it’s not allowed to attach bmp file here)

    2. Then I convert it using your example from documentation:

    public static void ConvertToPdfTest()
    {
    //Instantiate a Pdf object by calling its empty constructor
    var pdf1 = new Aspose.Pdf.Generator.Pdf();
     	<span style="color:green;">//Create a section in the Pdf object</span>
     	<span style="color:blue;">var</span> sec1 = pdf1.Sections.Add();
    
     	<span style="color:green;">//Create an image object in the section</span>
     	<span style="color:blue;">var</span> image1 = <span style="color:blue;">new</span> Aspose.Pdf.Generator.<span style="color:#2b91af;">Image</span>(sec1);
    
     	<span style="color:green;">//Add image object into the Paragraphs collection of the section</span>
     	sec1.Paragraphs.Add(image1);
    
     	<span style="color:green;">//Set the path of image file</span>
     	image1.ImageInfo.File = <span style="color:#a31515;">@"E:\Bugs\BMP_file\4.bmp"</span>;
    
     	<span style="color:green;">//Set the type of image using ImageFileType enumeration</span>
     	image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.<span style="color:#2b91af;">ImageFileType</span>.Bmp;
    
     	<span style="color:green;">//Set image title</span>
     	image1.ImageInfo.Title = <span style="color:#a31515;">"BMP Image"</span>;
    
     	<span style="color:green;">//Save the Pdf</span>
     	pdf1.Save(<span style="color:#a31515;">@"E:\Bugs\BMP_file\testBmp4.pdf"</span>);
     }</pre>3. Resulted Pdf file is attached<br><br>Aspose.Imaging.dll version: 3.0.0.0<br><br>
  1. Take 2.bmp file (it’s attached as .avi => rename it into .bmp)
    2. Convert it with aspose.imaging.dll

    public static void ConvertToPdfTest()
    {
    //Instantiate a Pdf object by calling its empty constructor
    var pdf1 = new Aspose.Pdf.Generator.Pdf();
     	<span style="color:green;">//Create a section in the Pdf object</span>
     	<span style="color:blue;">var</span> sec1 = pdf1.Sections.Add();
    
     	<span style="color:green;">//Create an image object in the section</span>
     	<span style="color:blue;">var</span> image1 = <span style="color:blue;">new</span> Aspose.Pdf.Generator.<span style="color:#2b91af;">Image</span>(sec1);
    
     	<span style="color:green;">//Add image object into the Paragraphs collection of the section</span>
     	sec1.Paragraphs.Add(image1);
    
     	<span style="color:green;">//Set the path of image file</span>
     	image1.ImageInfo.File = <span style="color:#a31515;">@"E:\Bugs\BMP_file\2.bmp"</span>;
    
     	<span style="color:green;">//Set the type of image using ImageFileType enumeration</span>
     	image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.<span style="color:#2b91af;">ImageFileType</span>.Bmp;
    
     	<span style="color:green;">//Set image title</span>
     	image1.ImageInfo.Title = <span style="color:#a31515;">"BMP Image"</span>;
    
     	<span style="color:green;">//Save the Pdf</span>
     	pdf1.Save(<span style="color:#a31515;">@"E:\Bugs\BMP_file\testBmp2.pdf"</span>);
     }</pre>3. Resulted pdf is created (attached) but if you try to open it shows error  "Insufficient data for an image"<br>

Hi Ulrik,


We believe you meant to post these concerns in Aspose.Pdf support forum because your provided code is using Aspose.Pdf for .NET API calls. Moreover, Aspose.Imaging APIs do not provide the functionality to convert raster images to PDF format. Based on these observations, I am going to move this thread to appropriate forum, that is; Aspose.Pdf support forum. My colleagues will soon get back to you with updates in this regard.

Hi Ulrik,


I believe you are using Aspose.Pdf for .NET API instead of Aspose.Imaging APIs to convert the BMP to PDF format. Please note, your provided code segment suggests the same, moreover, Aspose.Imaging APIs do not offer the means to render the raster images in PDF format. I am going to move this thread to the appropriate forums, that is; Aspose.Pdf support forum for further investigation into your presented scenario. My fellow co-workers will soon get back to you with updates in this regard.

I use Aspose.Pdf.Generator.Image as a type of image, yes, Aspose.Pdf version is 10.6.0.0

I use Aspose.Pdf.Generator.Image as a type of image, yes, Aspose.Pdf version is 10.6.0.0

Hi Ulrik,


Thanks for your inquiry. I am afraid I am unable to test your scenario as your shared image is 0 kb in size. We will appreciate it if you please share your image file again, so we will look into it and provide you information accordingly.

Moreover, you can zip your image file and attach here.

We are sorry for the inconvenience caused.

Best Regards,

This file is 30KB size. I attached it again, but the file is same as previously

Hi Ulrik,


Thanks for sharing your source image again. I have tested the scenario with new DOM approach for Image to PDF conversion and unable to notice any problem. Please download and try latest version of Aspose.Pdf for .NET it will resolve the issue.

Best Regards,

Ok about 2.bmp file.
Please note that there are 2 different problems with 2 different files.
“BMP file converts into ‘slush’” was the first problem with 1.bmp file (and has higher priority for us)

Hi Ulrik,


Thanks for your feedback. Please note size of 1.avi is also zero. You may try its conversion with new approach of image to PDF yourself or share it here, so we will look into it and provide you information accordingly.

We are sorry for the inconvenience caused.

Best Regards,

that’s really strange.
Attaching ones more the same file…

Hi Ulrik,


Thanks for sharing the source image again. I have tested the scenario with new DOM approach of Image to PDF conversion and unable to notice the reported issue. Please download latest version of Aspose.Pdf for .NET and try new DOM approach, it will resolve the issue.

Best Regards,

I downloaded new version, package “Aspose.Total_dll_only” and tried to convert files.
For now I have Aspose.Pdf 10.8.0.0 and there are still absolutely the same problems with 1.bmp and 2.bmp

Hi Ulrik,


Thanks for your inquiry. I have suggested you to use new generator (Aspose.Pdf) for Image to PDF conversion. Can you please double check that your are using Aspose.Pdf namespace instead Aspose.Pdf.Generator? If the issue still persist then please share your sample code here, so I will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,