Unable to create compatible TIFF

I need to create CCITT group 4 TIFF files for an external system. I have done this before, but this new system seems to bereally nitpicky. It refuses to use the TIFF produced by JAI no matter what I try, but if I save it in IrfanView it is accepted.

Can anybody give me some pointers to what I can change in the encoding process to make it compatible?

I used "tiffy" to view the metadata tags of the files, and here are the results:

The file produced by JAI:The file size is 20666 bytes.

Intel (little endian)byte order

IFD OFFSET = 8

The number of tags = 16

TagTypeLengthValue

256 Image WidthLONG12475(9ab Hex)

257 Image Length LONG13502(dae Hex)

258 Bits Per SampleSHORT11

259 CompressionSHORT14

262 PhotometricSHORT10

266 Fill OrderSHORT11

273 Strip Offsets LONG438<206>

274 OrientationSHORT11

277 Samples Per PixelSHORT11

278 Rows Per StripLONG18(8 Hex)

279 Strip Byte CountsLONG438<1958>

282 X Resolution RATIONAL 1<3710>300 / 1 = 300.000

283 Y Resolution RATIONAL 1<3718>300 / 1 = 300.000

284 Planar Configuration SHORT11

293 Group 4 OptionsLONG10(0 Hex)

296 Resolution UnitSHORT12

The file produced by IrfanView:The file size is 13388 bytes.

Intel (little endian)byte order

IFD OFFSET = 13164

The number of tags = 16

TagTypeLengthValue

256 Image WidthSHORT12475

257 Image Length SHORT13502

258 Bits Per SampleSHORT11

259 CompressionSHORT14

262 PhotometricSHORT10

266 Fill OrderSHORT11

273 Strip Offsets LONG18(8 Hex)

274 OrientationSHORT11

277 Samples Per PixelSHORT11

278 Rows Per StripSHORT13502

279 Strip Byte CountsLONG113155(3363 Hex)

282 X Resolution RATIONAL 1<13362> 629145600 / 2097152 = 300.000

283 Y Resolution RATIONAL 1<13370> 629145600 / 2097152 = 300.000

284 Planar Configuration SHORT11

296 Resolution UnitSHORT12

305 Software ASCII10<13378>IrfanView

There is a remarkable difference in size. Could this be it?

Or can the IFD offset be the problem?

Or the Strip offset/row/count?

Thanks in advance.

(I could make the TIFF available for download if it's helpful.)

[2415 byte] By [MattiasJa] at [2007-11-26 18:39:57]
# 1

It looks to me like it's a problem with your 'Rows Per Strip' tag.

Read this thread for more info on that: http://forum.java.sun.com/thread.jspa?threadID=5161294&tstart=0

We should be able to help you with your encoding process, but do you want to tell us how you're actually doing it at the moment? Some code would be helpful :-)

patricknza at 2007-7-9 6:13:59 > top of Java-index,Security,Cryptography...
# 2
Additionally, in your JAI created image, you are also missing the ResolutionUnit tag. Without that, I would suspect your XResolution and YResolution tags would be pretty meaningless.CowKing
IamCowKinga at 2007-7-9 6:13:59 > top of Java-index,Security,Cryptography...
# 3
We chose to do the conversion outside Java (using ImageMagick) instead. Makes things a bit more complicated, but saves JVM memory.This was put in production earlier this week.
MattiasJa at 2007-7-9 6:13:59 > top of Java-index,Security,Cryptography...