2003.11.17 09:28 "[Tiff] tiff2pdf contribution", by Ross Finlayson

2003.11.21 17:21 "[Tiff] tiff2pdf contribution", by Ross Finlayson

Hi Leonard,

Again, trasnforming the CTM, Current Translation (Transformation?) Matrix, is probably a more direct route, but if the output format didn't have a CTM, for example as TIFF doesn't, then functions to orient the data would be useful to fully implement TIFFReadRGBAOriented, for example.

Also, to do matrix math I would have to study for days or at least hours before I came across the right equations, although as we are talking about right angles sine and cosine are 0 and +-1.

For the basic cases, it's not that bad - and the algorithms are well defined and available online...

Yeah, I guess that's true.

Most programs use either top-left or bottom-left. I'm kind of unclear at the moment but I think PDF uses a bottom-left coordinate matrix.

Yes, PDF/PS uses bottom-left origin (though you can change it if you really want to, but it just makes things harder).

The XObject image that is the raster element in PDF is however filled top-left, in the same way as the default TIFF orientation.

The data is filled in top/left - or really just the standard order of the pixels. HOWEVER, when that XObject is placed into the PDF page, it's location/position is given based on the bottom left of the image.

When sending the output to something like PDF, where we might be using the CTM transform and let the PDF browser do the lifting, I'm wondering about the Rotate parameter of the Page structure.

You could also use the page's Rotate parameter for your sample utility since it only places one image per page - that would work fine.

It says to set Rotate to /90 /180 or /270 if I recall correctly (IIRC) and that the page would be rotated thusly in viewing and printing mode. See, I don't want to use that because the only reason to rotate the page is to print it portrait nd view it landscape for ledgers.

That's one use for /Rotate...

If you could explain the /Rotate field that would be good. I think there should be different rotate flags for view and print.

The /Rotate would be sufficient for rotating the page, but there are also the four more options to flip or mirror the page.

I've implemented it but it doesn't work right on tiled images with TIFF orientation > 4. I have here a tiled JPEG that has orientation 4 and each row is flipped. I'm wondering in what ways people implemented TIFF orientation with tiled images.

One thing I'm wondering about are some varieties of fax images. I want to see how it works on the fax images where when the page is only a partial the image ends, in some rare cases the short page is left at the bottom of the image instead of the top. Another thing I've heard about are images with MSB-to-LSB fill order that set LSB-to-MSB. I was trying to figure out way to inspect the first byte of Group III/Group IV data to sex it. Some images have incorrect photometric tags.

Hey, check it out, try and break it. Please let me know if it causes any segment faults or access violations. If you are using OJPEG it requires the patch from CVS. Please let me know if you find any known good images that it doesn't handle correctly.

I'm not quite sure why the tiled images with orientation greater than 4 are not working right. That's only in the case with edge tiles and padding.

I'll try and fix that, then I'll try and get it working on separated planar configuration images, and that should about do it. Well, I guess there's also colorimetry, I want to figure that out. Then that's definitely almost it.

Ross F.