| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2005.05.25 12:30 "Re: Question about Jpeg-in-tiff, JPEG IN TIFF created by libtiff can't be read by acdsee", by Joris Van Damme> uint32 rowsperstrip = TIFFDefaultStripSize(m_tif, (uint32) -1);
> TIFFSetField(m_tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
This line, you might want to change, if you set out to write a single strip
TIFF. Set rowsperstrip to the pBitmapHeaderInfo->biHeight. That should cause the
TIFF to be written as a single strip.
> When i use TIFFSetField(m_tif, TIFFTAG_ROWSPERSTRIP, height);
> it seems the jpeg-data was writed as a single strip.but ACDSEE still can't
> opened it.
Like Jean-Yves said, a tiffinfo or tiffdump or AsTiffTagViewer dump of the
offending file might help us identify the problem. It is of course entirely
possible the ACDSEE just sucks, of course, when it comes to jpeg-in-tiff, and
that none of us can do anything about that.
> Or is there another way could do it ?
> such as "Attach" & "Detach" the JPEG-data into(out of) TIFF file as a single
> strip(or tile), without doing compress or decompress the image data.
> thus save the time & image quality ,is it possible ?
I've been thinking on and off about this, recently...
First important issue here, is that JPEG allows for some YCbCrSubsampling values
that TIFF does not like. So any scheme for direct transcoding from JPEG to
JPEG-in-TIFF, cannot possibly work for all possible JPEGs.
This being said, it should be possible for the vast majority, though. What I
would do, is something like this:
- start scanning the JPEG file up to the SOS marker. The markers you encounter
this way...
- some, you might just want to ignore, like the SOI marker and unknown APP
markers
- some identify the colorspace, some identify YCbCrSubsampling values, these
should be interpreted, and the results should be stored
- some like DHT and DQT contain tables, the tables should be stored in temp
memory, too
- now start building the TIFF file. The previous stage should have yielded
proper values for ImageWidth, ImageLength, Photometric, YCbCrSubsampling, and
all needed tags.
- now start writing the compressed single strip
- start with SOI marker
- continue with the saved table markers, and the needed SOF and SOI marker
and such
- append the rest of the JPEG file
> does anyone do some research on it ?
The above is only what I thought of doing, I never actually tried it. (Except
that I did succeed in decoding ojpeg files properly with a similar JPEG-stream
filtering/rebuilding scheme.) But if anyone wants to have a go at it, I'll be
all ears and eager to help if I can.
Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
|
|||||||