TIFF format saved is not correct (.bmp to .tiff)

Hi,


I have query regarding BMP to TIFF conversion.
I have been using following code but seems the TIFF file generated doesn’t have correct format and hence is not recognizable by other s/w.

File attached. It doesn’t have summary info:
code I am using is:

Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(strInPath + “\” + strInFile);
Aspose.Imaging.ImageOptions.TiffOptions saveOptions = new Aspose.Imaging.ImageOptions.TiffOptions();
image.Save(strOutPath + “\” + strOutFile, saveOptions);


Please can you help me where I am going wrong? Do I have to specify anything else?

Thank you,
Hitesh

Hi Hitesh,


Thanks for your inquiry. I’m afraid attachment is missing. Please share your sample input(.bmp) and output image. Please also mention the imaging s/w failing to recognize output tiff image. So we will test it at our end and provide you information accordingly.

Sorry for the inconvenience faced.

Best Regards,

Hi Tilal,

Thanks for the reply.

It seems I am unable to upload the document. It gives me the following message:

Only files with the following extensions are allowed: zip,cab,jpg,gif,png,mpg,mpeg,avi,wmv,wma,mp3,ra,rar,rm,sql,txt,xls,doc,pdf,rdl,ppt,docx,xlsx,pptx,xlsm,tif,rtf,dot,xml,odt,odp,jrprint,ods,csv,xsn,xps,7z. Please select a valid file.
I need to attach .bmp and .TIFF files.
If you can give me some email id then I can reply to that email with attachments.
Thank you,
Hitesh

Hi Tilal,


sorry, I could zip the files.
Attached are the zipped files.

I tried converting .bmp to .tiff file. The tiff file converted doesn’t have summary data (right click->properties->summary).


Thank you,
Hitesh

Hi Hitesh,


Thanks for sharing source images. I’m afraid I couldn’t find the properties>summary option, could you please mention the software you are using for the purpose. Moreover, I’ve successfully opened and viewed the details of tiff image with IrfanView and Windows Photo viewer.

Sorry for the inconvenience faced.

Best Regards,

Hi Tilal,


Thanks,
What I meant by properties is

1. Right click on the image
2. Select properties
3. Select Summary tab

If you right click on .bmp image then you will see it has proper summary info. The tiff image doesn’t have proper summary info.
Why??

Thank you,
Hitesh

Hi Hitesh,


Thanks for your feedback. Please find attached screen shot of image properties for Bmp and Tiff images. You have exported Tiff image with default properties. You can specify different properties of TiffOptions class at the time of conversion according to you need.

Please feel free to contact us for any further assistance.

Best Regards,

Thanks Tilal.

Is there any compression type I can use to compress .bmp image and save it as .TIFF? I don't know much about image compressions but would like to reduce the size of the .TIFF generated.

If you can see the .TIFF image (732 KB)and .BMP (4 KB)image then you can compare the image sizes i.e. TIFF generated is too large.

Please can you help me reduce the size of the TIFF generated?

Thank you,

Hitesh

Also, SaveOptionsBase is not available in .NET

seems the example you have used has SaveOptionsBase but it's not there in DLL.

http://www.aspose.com/demos/.net-components/aspose.imaging/csharp/Exporting-Images/Export-to-various-formats.aspx

If you don't mind then can you please show me the correct code to covert .bmp to .tiff?

Thank you,

Hitesh

Hi Hitesh,


Thanks for your inquiry, Please check following code to compress a tiff image using TiffOptions class. Moreover, you are right SaveOptionBase is obsolete in current API. We are in process of revamping our demos/examples and it will be fixed soon.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(myDir + “Sampleocr.bmp”))
{
TiffOptions tiffOptions = new TiffOptions();
tiffOptions.Compression = TiffCompressions.CcittFax4;
//Export to TIFF file format using the tiffOptions
image.Save(myDir + “Sampleocr_wo_ccit4.tiff”, tiffOptions);
}

Please feel free to contact us for any further assistance.

Best Regards,

Thanks Tilal.

I have used the same code to convert the file. Basically, I have couple of concerns

1. The compression you mentioned distorts the generated TIFF image. Is there any way I can preserve the image i.e. image can be viewed in IrfanView/MS Paint after compression?

2. The generated file cannot be opened in MS paint in Windows XP but it can be opened up in Windows 7. Do you know why? Attached are couple of files for testing.

Thank you,

Hitesh

Hi Tilal,

Any updates?? Please test TIFF conversion for .Jpeg file format. Seems .JPEG and .PNG doesn't work with the compression mentioned.

Hi Hitesh,


Thanks for your findings. I’ve manged to notice issue with Jpeg to Tiff conversion with compression and logged in our issue tracking system as IMAGING-33435 for further investigation. However, unable to notice issue with Png and Bmp conversion. please find attached images for reference.

Moreover, Windows XP has known issue viewing tiff images. Please try following setting or can use some image viewer e.g. Irfanview.

  • Click Start, Programs, Accessories, then Windows Explorer
  • In Windows Explorer, select Tools, and then Folder Options…
  • Click the File Types tab
  • Select the TIF extension and click Change…
    • If a tif extension is not present click new to add it to the listing.
  • Select Windows Imaging, Microsoft Office Document Imaging or another program of your choosing and click OK.

Best Regards,

Hi Tilal,

It seems Jpeg to TIFF doesn't work at all. On top of that if you don't specify compression type (i.e. use default settings) then none of the conversion to TIFF works (bmp, png, gif).

Also, if you specify TiffCompressions.CcittFax4 for png; then the TIFF image converted is rendered color less.

Is there any way I can specify the color depth (for Format8bppIndexed)?

Thank you,

Hitesh

Hi Hitesh,


Thanks for your inquiry. In reference to Jpeg to Tiff conversion, we have noticed the issue and logged in our issue tracking system for resolution. Now we have good news for you that Jpeg to Tiff conversion issue has been resolved and its fix will be available in upcoming release of Aspose.Imaging version i.e 1.8.0.

Moreover, I’m afraid I couldn’t not observe the PNG to tiff issue, please find attached sample output. Please use bitspersample property of TiffOptions is used to set bit depth.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(myDir + “Sampleocr.png”))
{
/* //Export to BMP file format using the default options
image.Save(myDir + “Sampleocr.gif”, new Aspose.Imaging.ImageOptions.GifOptions());

TiffOptions createOptions = new TiffOptions();
// createOptions.BitsPerSample = 8;
createOptions.Compression =TiffCompressions.CcittFax4;
//Export to TIFF file format using TiffOptions
image.Save(myDir + “Sampleocr_ccit4png.tiff”, createOptions);
}

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.