Free Support Forum - aspose.com

Save as Tif

Dear Team,

I have question about the save as tif.
We have a hard requirement about the exact nature of the Tif images that are exported.
THe Tiff images must be Tiff V6 Group 4 compliant,
Must have the Intel Encoding
Must use 1 sample per byte
And must have single strip.

When inspecting the tiff that are generated I see that they have the Motorola Encoding and not the intel encoding/byte order

Is there anything I can set to create tif with the intel encoding/byte order

I use the following code for the rendering to tiff

ShapeRenderer renderer = new ShapeRenderer(shape);
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.TIFF);
options.setUseHighQualityRendering(true);
options.setResolution(300.0F);
options.setTiffCompression(TiffCompression.CCITT_4);
options.setImageColorMode(ImageColorMode.BLACK_AND_WHITE);

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    renderer.save(stream, options);

Many thanks for your support,

Regards

Patrick

@PatrickVB,

We are working over your query and will get back to you soon.

Thanks a lot.
I’m realy looking forward to your answer.
This is kind of blocking for us.

Regards

Patrick

@PatrickVB,

We believe you can meet your requirements by using the following code:
MainClass.zip (1.0 KB)

Many thanks. I will try.

I have tested it and it works as expected.
However when testing with https://github.com/drewnoakes/metadata-extractor/wiki/File-Type-Detection, I do not get the TIFF file type, but ARW file type.

Before the introducting of the TIFFImageDecoder/TIFFImageEncoder the resulting file did have the TIFF type tag.

Any ideas

KR

Patrick

@PatrickVB,

We are working over your query and will get back to you soon.

Any update on this topic

@PatrickVB,

Thanks for being patient. We are working over your query and will get back to you soon.

Any update on this-
The different fileType is not becoming blocking.
The images are not imported any more in the receiving client.

Thanks for providing me at least with an ETA:

@PatrickVB,

We have linked your thread to appropriate issue (WORDSJAVA-1769). We will inform you as soon as this issue is resolved or any further updates are available. We apologize for any inconvenience.

@PatrickVB,

Regarding WORDSJAVA-1769, please see attached an example (Example.zip (2.1 KB)) which you can run on your end.

Yes, external tool (com.drewnoakes) detects generated file incorrectly (see img2.zip (17.1 KB)). This software takes file’s bytes and tries to find most suitable file format using masks. It can be seen that TIFF and ARW in the library have close structure (see img1.zip (43.4 KB)) but according to TIFF’s documentation (http://www.fileformat.info/format/tiff/corion.htm) TIFF file could also be started with {0x2a, 0x00, 0x08, 0x00} bytes. So in this case there is no difference between ARW and TIFF. It is not enough to detect format properly.

We suggest you please inform developers of that library and ask them to be more specific about detecting ARW/TIFF formats.

So, this is not an issue. TIFF file generated by code above is correct. In addition, you may also check it by opening it in any external tool such as InfanView.

Hi Awais,

Many thanks for your detailed overview. I will further check.

Kind regards

Patrick