<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-16527</id>
	<title>Nabble - Tiff / LibTiff</title>
	<updated>2009-12-12T10:27:15Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/Tiff---LibTiff-f16527.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Tiff---LibTiff-f16527.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26760170</id>
	<title>Re: YCbCr</title>
	<published>2009-12-12T10:27:15Z</published>
	<updated>2009-12-12T10:27:15Z</updated>
	<author>
		<name>Antonio Scuri</name>
	</author>
	<content type="html">&amp;gt; So, you can store either RGB, YCbCr, or CMYK data in TIFF files.
&lt;br&gt;&amp;gt; However, due to the variable conversion algorithms used for converting
&lt;br&gt;&amp;gt; to/from CMYK or YCbCr, anything other than RGB is probably not likely
&lt;br&gt;&amp;gt; to work outside of whatever application creates them. &amp;nbsp;Is that a
&lt;br&gt;&amp;gt; correct statement?
&lt;br&gt;&lt;br&gt;&amp;nbsp; No, I said only for CMYK. YCbCr has a very precise conversion for RGB.
&lt;br&gt;&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;gt; Also, if a user employs the automatic conversion process to get from
&lt;br&gt;&amp;gt; YCbCr to RGB, doesn't the wide variety of possible conversion matrices
&lt;br&gt;&amp;gt; for this process make the automatic conversion somewhat inconsistent or
&lt;br&gt;&amp;gt; even incorrect in some cases? &amp;nbsp;
&lt;br&gt;&amp;gt; Does LibTiff implement the most common
&lt;br&gt;&amp;gt; conversion matrix (if that's even clearly defined) for this automatic
&lt;br&gt;&amp;gt; process, or is there some guess at a conversion matrix based on the
&lt;br&gt;&amp;gt; data itself?
&lt;br&gt;&lt;br&gt;&amp;nbsp; Both no, for the same reason.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; It just seems to me that storing image data in anything other than RGB-
&lt;br&gt;&amp;gt; based formats is not a good idea for most general usages and should
&lt;br&gt;&amp;gt; only be employed if the images are used for internal program processing
&lt;br&gt;&amp;gt; only. &amp;nbsp;Otherwise, the matrix employed to generate the YCbCr or CMYK
&lt;br&gt;&amp;gt; format is not known to a reader of the file.
&lt;br&gt;&lt;br&gt;&amp;nbsp; As Toby explained, CMYK is used for publishing workflows. And the conversion is complicated. No it is not commonly used. 
&lt;br&gt;&lt;br&gt;&amp;nbsp; On the other hand YCbCr is widely used. Mostly because you can separate luminance and chrominance information, and compress them with different approaches. Almost all JPEG files are stored in this way (I mean *.jpg).
&lt;br&gt;&lt;br&gt;&amp;nbsp; So actually it depends on what your application does. Also depends on what file format/compression you choose. 
&lt;br&gt;&lt;br&gt;Best,
&lt;br&gt;Scuri
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26760170&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26760170.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26760059</id>
	<title>Re: YCbCr</title>
	<published>2009-12-12T10:19:39Z</published>
	<updated>2009-12-12T10:19:39Z</updated>
	<author>
		<name>Bob Friesenhahn</name>
	</author>
	<content type="html">On Sat, 12 Dec 2009, Gene Amtower wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; So, you can store either RGB, YCbCr, or CMYK data in TIFF files.  However, due to the variable conversion
&lt;br&gt;&amp;gt; algorithms used for converting to/from CMYK or YCbCr, anything other than RGB is probably not likely to work
&lt;br&gt;&amp;gt; outside of whatever application creates them.  Is that a correct statement?
&lt;br&gt;&lt;br&gt;While CMYK is quite variable since it is device dependent, YCbCr is 
&lt;br&gt;defined by several ITU specifications (Rec.601 or Rec.709) and is 
&lt;br&gt;therefore quite well defined.
&lt;br&gt;&lt;br&gt;While YCbCr should work quite nicely in TIFF, the only common use 
&lt;br&gt;seems to be in conjunction with JPEG compression.
&lt;br&gt;&lt;br&gt;Except for issues related to subsampling (which requires horizontal, 
&lt;br&gt;and sometimes even vertical filters), YCbCr is not difficult to work 
&lt;br&gt;with.
&lt;br&gt;&lt;br&gt;&amp;gt; It just seems to me that storing image data in anything other than 
&lt;br&gt;&amp;gt; RGB-based formats is not a good idea for most general usages and 
&lt;br&gt;&amp;gt; should only be employed if the images are used for internal program 
&lt;br&gt;&amp;gt; processing only.  Otherwise, the matrix employed to generate the 
&lt;br&gt;&amp;gt; YCbCr or CMYK format is not known to a reader of the file.
&lt;br&gt;&lt;br&gt;For general usage, you should stick to baseline TIFF.
&lt;br&gt;&lt;br&gt;Bob
&lt;br&gt;--
&lt;br&gt;Bob Friesenhahn
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26760059&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bfriesen@...&lt;/a&gt;, &lt;a href=&quot;http://www.simplesystems.org/users/bfriesen/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.simplesystems.org/users/bfriesen/&lt;/a&gt;&lt;br&gt;GraphicsMagick Maintainer, &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.GraphicsMagick.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.GraphicsMagick.org/&lt;/a&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26760059&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26760059.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26759836</id>
	<title>Re: YCbCr</title>
	<published>2009-12-12T09:34:30Z</published>
	<updated>2009-12-12T09:34:30Z</updated>
	<author>
		<name>Toby Thain-2</name>
	</author>
	<content type="html">&lt;html&gt;&lt;body style=&quot;word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; &quot;&gt;
&lt;br&gt;&lt;div&gt;&lt;div&gt;On 12-Dec-09, at 11:37 AM, Gene Amtower wrote:&lt;/div&gt;&lt;br class=&quot;Apple-interchange-newline&quot;&gt;&lt;blockquote type=&quot;cite&quot;&gt; So, you can store either RGB, YCbCr, or CMYK data in TIFF files.&amp;nbsp; However, due to the variable conversion algorithms used for converting to/from CMYK or YCbCr, anything other than RGB is probably not likely to work outside of whatever application creates them.&amp;nbsp; Is that a correct statement?&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Not really with respect to CMYK. TIFF is commonly used as an interchange format, e.g. from scanner to artist's computer. It is also commonly used as an archive/working format for print-oriented images. The actual interpretation of data is either by tacit agreement (e.g. &quot;We assume SWOP inks, 20% dot gain&quot;) and corresponding program settings, or by embedded ICC profile. Software in print production has historically used both (specifically Quark XPress, InDesign, Photoshop, etc).&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Historically, CMYK workflows were based on passing through the scanned data without profile-based re-interpretation:&lt;/div&gt;&lt;div&gt;– initial transparency scan in CMYK from a drum scanner with 'internal' tacit characteristics (e.g. UCR, dot gain)&lt;/div&gt;&lt;div&gt;– transport to artist's computer&lt;/div&gt;&lt;div&gt;– import to layout where an RGB proxy is generated&lt;/div&gt;&lt;div&gt;– generation of PostScript separations referencing original CMYK scan (e.g. to film)&lt;/div&gt;&lt;div&gt;– production of printing plates&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;This workflow (typical during 1990s) would assume that the parameters and data of the original scan were correctly tuned for the end product – usually offset lithographic printing. It is also based on film photography. TIFF is ubiquitous in this workflow as given the software available at the time, it was the most efficient and reliable of the alternatives.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Nowadays this flow would include profile based conversions and the original data is much more commonly non-CMYK digital data. Separation occurs late in the process, is done &quot;on the fly&quot;, and would also involve a profile for the output device. So in a modern workflow there is in fact very little place for CMYK TIFF except when dealing with 'legacy' data.&lt;/div&gt;&lt;br&gt;&lt;blockquote type=&quot;cite&quot;&gt; &lt;br&gt; ...&lt;br&gt; &lt;br&gt; It just seems to me that storing image data in anything other than RGB-based formats is not a good idea for most general usages &lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;In CMYK common usage would be existing archives of imagery intended for print&amp;nbsp;(of which there must exist an enormous quantity in archives generated over the last 20 years).&lt;/div&gt;&lt;br&gt;&lt;blockquote type=&quot;cite&quot;&gt;and should only be employed if the images are used for internal program processing only.&amp;nbsp; Otherwise, the matrix employed to generate the YCbCr or CMYK format is not known to a reader of the file.&lt;br&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;The CMYK would typically be generated by a &quot;black box&quot;, for example a drum scanner. It is possible to characterise this by an ICC profile but this is not always done. But then RGB is not really different in this respect.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;--Toby&lt;/div&gt;&lt;br&gt;&lt;blockquote type=&quot;cite&quot;&gt; &lt;br&gt; Am I on the right track, or does LibTiff provide some means to communicate the conversion matrix to any other program reading the TIFF file?&lt;br&gt; &lt;br&gt; Thanks,&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp; Gene&lt;br&gt; &lt;br&gt; On Sat, 2009-12-12 at 00:37 -0200, Antonio Scuri wrote:&lt;br&gt; &lt;blockquote type=&quot;CITE&quot;&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&amp;nbsp;My recommendation for you is to start at the TIFF format specification pdf. It has several interesting explanations that will answer some of your questions.&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp; Anyway, here are some comments. &lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp; Yes there is no pre-defined conversion between CMYK and everything else. It really depends on how you should interpret the K component, and this usually involves the printer profile you are going to use.&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp; Using libTIFF you can access images that are in the YCbCr color space in its raw state or with an automatic conversion to RGB. At least in the JPEG compression. The libtiff high level functions to load an RGB image do not use the automatic conversion, they load the image as YCbCr and then convert the raw data to RGB itself. By the way this is a recent change in libtiff.&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;Best Regards,&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;Antonio Scuri&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;b&gt;&lt;font color=&quot;#000000&quot;&gt;From:&lt;/font&gt;&lt;/b&gt;&lt;font color=&quot;#000000&quot;&gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759836&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt; [&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759836&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt;] &lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;b&gt;On Behalf Of &lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Gene Amtower&lt;/font&gt;&lt;br&gt;    &lt;b&gt;&lt;font color=&quot;#000000&quot;&gt;Sent:&lt;/font&gt;&lt;/b&gt;&lt;font color=&quot;#000000&quot;&gt; sexta-feira, 11 de dezembro de 2009 17:11&lt;/font&gt;&lt;br&gt;    &lt;b&gt;&lt;font color=&quot;#000000&quot;&gt;To:&lt;/font&gt;&lt;/b&gt;&lt;font color=&quot;#000000&quot;&gt; Steve Mills&lt;/font&gt;&lt;br&gt;    &lt;b&gt;&lt;font color=&quot;#000000&quot;&gt;Cc:&lt;/font&gt;&lt;/b&gt;&lt;font color=&quot;#000000&quot;&gt; tiff list&lt;/font&gt;&lt;br&gt;    &lt;b&gt;&lt;font color=&quot;#000000&quot;&gt;Subject:&lt;/font&gt;&lt;/b&gt;&lt;font color=&quot;#000000&quot;&gt; Re: [Tiff] YCbCr&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;Well, I was following this thread thinking I might learn something from the discussion, but somewhere along the way, it went off the tracks for me!&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;This last post confuses me because the original post mentioned that the TIFFTAG_PHOTOMETRIC tag was reporting YCbCr, where as this one suggests the image is in CMYK.&amp;nbsp; Are we still talking about the original image from the first post?&amp;nbsp; If so, why is there this apparent contradiction between the first and last post?&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;All of this info got me to reading on the web, and I see that YCbCr is a colorspace primarily used for signal transmission to reduce the amount of transmission bandwidth, hence the downsampling of the Cb and Cr components because they carry less data.&amp;nbsp; Info on Wikipedia provides conversion formulas to/from RGB that depend on conversion factors that are not universal.&amp;nbsp; From these formulas, a red pixel ends up generating a value in each of the Y, Cb, and Cr pixel values because &quot;Y&quot; carries the primary luminance info, while Cb and Cr only communicate a &quot;difference&quot; value for the Red and Blue components.&amp;nbsp; It also suggested to me that you can't really view YCbCr values directly because they are calculated values used in data transmission that aren't directly related to the RGB world that we live in.&amp;nbsp; From what I can tell, YCbCr and CMYK are completely different colorspaces for either signal transmission or printing (respectively), and converting from one to the other actually involves an intermediate pass through the RGB space, with both conversions involving variable formulas that depend on hardware-dependent and implementation-dependent mapping algorithms.&amp;nbsp; It sounds like there is NO universal way to convert between these three representations.&amp;nbsp; There's also the RGBA colorspace that includes transparency info in the Alpha A channel - does this impact YCbCr and CMYK representations at all, or is this impossible in these alternate colorspaces?&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;If anyone cares to enlighten me, can you help me understand this discussion on LibTiff handling of RGB, CMYK, and YCbCr without going into a long dissertation on images, color spaces, TVs, and printing processes?&amp;nbsp; Is it possible to store YCbCr image data in a TIFF file?&amp;nbsp; If so, are there mechanisms built into LibTiff to convert it automatically to RGB for viewing, or is that up to the primary application to perform necessary conversions to the viewable world?&amp;nbsp; With the inherent variability of YCbCr color values, how would Steve even know if he was getting valid YCbCr data when reading the values from the image file?&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;I guess a quick summary of the colorspace capabilities in LibTiff and the Tiff standard in general would be really helpful to the uninitiated among us.&amp;nbsp; I know there's a lot of vagueness in the TIFF standard, but explain as much as possible, please!&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;Thanks,&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&amp;nbsp; Gene&lt;/font&gt;&lt;br&gt;    &lt;br&gt;    &lt;br&gt;    &lt;br&gt;    &lt;font color=&quot;#000000&quot;&gt;On Fri, 2009-12-11 at 10:58 -0600, Steve Mills wrote: &lt;/font&gt;&lt;br&gt;    &lt;br&gt; &lt;pre&gt;&lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;On Dec 11, 2009, at 10:15:39, Antonio Scuri wrote:&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;gt;&amp;nbsp; As Joris pointed out, you actually get Y Cb and Cr planes. So the first&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;What if the file is jpeg-compressed cmyk? The TIFFTAG_PHOTOMETRIC tag says it's cmyk, not YCbCr. I expect cmyk data in this case, but it sure doesn't look correct.&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;_________________________________________________________&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;Steve Mills&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me: 952-401-6255&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;Senior Software Architect&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MultiAd&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759836&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.multi-ad.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;www.multi-ad.com&lt;/a&gt;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;_______________________________________________&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759836&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;/font&gt;
&lt;font color=&quot;#000000&quot;&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;/font&gt;
&lt;/pre&gt; &lt;/blockquote&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;_______________________________________________&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759836&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; &quot;&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;/div&gt; &lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/body&gt;&lt;/html&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759836&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26759836.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26759284</id>
	<title>Re: YCbCr</title>
	<published>2009-12-12T08:37:58Z</published>
	<updated>2009-12-12T08:37:58Z</updated>
	<author>
		<name>Gene Amtower</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 TRANSITIONAL//EN&quot;&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
  &lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; CHARSET=UTF-8&quot;&gt;
  &lt;META NAME=&quot;GENERATOR&quot; CONTENT=&quot;GtkHTML/3.3.2&quot;&gt;
&lt;/HEAD&gt;
&lt;BODY LINK=&quot;#0000ff&quot;&gt;
So, you can store either RGB, YCbCr, or CMYK data in TIFF files.&amp;nbsp; However, due to the variable conversion algorithms used for converting to/from CMYK or YCbCr, anything other than RGB is probably not likely to work outside of whatever application creates them.&amp;nbsp; Is that a correct statement?&lt;BR&gt;
&lt;BR&gt;
Also, if a user employs the automatic conversion process to get from YCbCr to RGB, doesn't the wide variety of possible conversion matrices for this process make the automatic conversion somewhat inconsistent or even incorrect in some cases?&amp;nbsp; Does LibTiff implement the most common conversion matrix (if that's even clearly defined) for this automatic process, or is there some guess at a conversion matrix based on the data itself?&lt;BR&gt;
&lt;BR&gt;
It just seems to me that storing image data in anything other than RGB-based formats is not a good idea for most general usages and should only be employed if the images are used for internal program processing only.&amp;nbsp; Otherwise, the matrix employed to generate the YCbCr or CMYK format is not known to a reader of the file.&lt;BR&gt;
&lt;BR&gt;
Am I on the right track, or does LibTiff provide some means to communicate the conversion matrix to any other program reading the TIFF file?&lt;BR&gt;
&lt;BR&gt;
Thanks,&lt;BR&gt;
&lt;BR&gt;
&amp;nbsp;&amp;nbsp; Gene&lt;BR&gt;
&lt;BR&gt;
On Sat, 2009-12-12 at 00:37 -0200, Antonio Scuri wrote:&lt;BR&gt;
&lt;BLOCKQUOTE TYPE=CITE&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&amp;nbsp;My recommendation for you is to start at the TIFF format specification pdf. It has several interesting explanations that will answer some of your questions.&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp; Anyway, here are some comments. &lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp; Yes there is no pre-defined conversion between CMYK and everything else. It really depends on how you should interpret the K component, and this usually involves the printer profile you are going to use.&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp; Using libTIFF you can access images that are in the YCbCr color space in its raw state or with an automatic conversion to RGB. At least in the JPEG compression. The libtiff high level functions to load an RGB image do not use the automatic conversion, they load the image as YCbCr and then convert the raw data to RGB itself. By the way this is a recent change in libtiff.&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;Best Regards,&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;Antonio Scuri&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt;From:&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759284&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt; [mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759284&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt;] &lt;/FONT&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt;&lt;B&gt;On Behalf Of &lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt;Gene Amtower&lt;/FONT&gt;&lt;BR&gt;
    &lt;B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt;Sent:&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt; sexta-feira, 11 de dezembro de 2009 17:11&lt;/FONT&gt;&lt;BR&gt;
    &lt;B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt;To:&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt; Steve Mills&lt;/FONT&gt;&lt;BR&gt;
    &lt;B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt;Cc:&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt; tiff list&lt;/FONT&gt;&lt;BR&gt;
    &lt;B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt;Subject:&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#000000&quot;&gt; Re: [Tiff] YCbCr&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;Well, I was following this thread thinking I might learn something from the discussion, but somewhere along the way, it went off the tracks for me!&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;This last post confuses me because the original post mentioned that the TIFFTAG_PHOTOMETRIC tag was reporting YCbCr, where as this one suggests the image is in CMYK.&amp;nbsp; Are we still talking about the original image from the first post?&amp;nbsp; If so, why is there this apparent contradiction between the first and last post?&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;All of this info got me to reading on the web, and I see that YCbCr is a colorspace primarily used for signal transmission to reduce the amount of transmission bandwidth, hence the downsampling of the Cb and Cr components because they carry less data.&amp;nbsp; Info on Wikipedia provides conversion formulas to/from RGB that depend on conversion factors that are not universal.&amp;nbsp; From these formulas, a red pixel ends up generating a value in each of the Y, Cb, and Cr pixel values because &amp;quot;Y&amp;quot; carries the primary luminance info, while Cb and Cr only communicate a &amp;quot;difference&amp;quot; value for the Red and Blue components.&amp;nbsp; It also suggested to me that you can't really view YCbCr values directly because they are calculated values used in data transmission that aren't directly related to the RGB world that we live in.&amp;nbsp; From what I can tell, YCbCr and CMYK are completely different colorspaces for either signal transmission or printing (respectively), and converting from one to the other actually involves an intermediate pass through the RGB space, with both conversions involving variable formulas that depend on hardware-dependent and implementation-dependent mapping algorithms.&amp;nbsp; It sounds like there is NO universal way to convert between these three representations.&amp;nbsp; There's also the RGBA colorspace that includes transparency info in the Alpha A channel - does this impact YCbCr and CMYK representations at all, or is this impossible in these alternate colorspaces?&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;If anyone cares to enlighten me, can you help me understand this discussion on LibTiff handling of RGB, CMYK, and YCbCr without going into a long dissertation on images, color spaces, TVs, and printing processes?&amp;nbsp; Is it possible to store YCbCr image data in a TIFF file?&amp;nbsp; If so, are there mechanisms built into LibTiff to convert it automatically to RGB for viewing, or is that up to the primary application to perform necessary conversions to the viewable world?&amp;nbsp; With the inherent variability of YCbCr color values, how would Steve even know if he was getting valid YCbCr data when reading the values from the image file?&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;I guess a quick summary of the colorspace capabilities in LibTiff and the Tiff standard in general would be really helpful to the uninitiated among us.&amp;nbsp; I know there's a lot of vagueness in the TIFF standard, but explain as much as possible, please!&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;Thanks,&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&amp;nbsp; Gene&lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
    &lt;BR&gt;
    &lt;BR&gt;
    &lt;FONT COLOR=&quot;#000000&quot;&gt;On Fri, 2009-12-11 at 10:58 -0600, Steve Mills wrote: &lt;/FONT&gt;&lt;BR&gt;
    &lt;BR&gt;
&lt;PRE&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;On Dec 11, 2009, at 10:15:39, Antonio Scuri wrote:&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;gt;&amp;nbsp; As Joris pointed out, you actually get Y Cb and Cr planes. So the first&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;What if the file is jpeg-compressed cmyk? The TIFFTAG_PHOTOMETRIC tag says it's cmyk, not YCbCr. I expect cmyk data in this case, but it sure doesn't look correct.&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;_________________________________________________________&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;Steve Mills&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me: 952-401-6255&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;Senior Software Architect&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MultiAd&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759284&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A HREF=&quot;http://www.multi-ad.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;www.multi-ad.com&lt;/A&gt;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;nbsp;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;_______________________________________________&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759284&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&lt;A HREF=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/A&gt;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&lt;A HREF=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/A&gt;&lt;/FONT&gt;
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26759284&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26759284.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26754567</id>
	<title>Re: YCbCr</title>
	<published>2009-12-11T18:37:36Z</published>
	<updated>2009-12-11T18:37:36Z</updated>
	<author>
		<name>Antonio Scuri</name>
	</author>
	<content type="html">&lt;html xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns:m=&quot;http://schemas.microsoft.com/office/2004/12/omml&quot; xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;

&lt;head&gt;
&lt;meta http-equiv=Content-Type content=&quot;text/html; charset=utf-8&quot;&gt;
&lt;meta name=Generator content=&quot;Microsoft Word 12 (filtered medium)&quot;&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapedefaults v:ext=&quot;edit&quot; spidmax=&quot;1026&quot; /&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapelayout v:ext=&quot;edit&quot;&gt;
  &lt;o:idmap v:ext=&quot;edit&quot; data=&quot;1&quot; /&gt;
 &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;
&lt;/head&gt;

&lt;body lang=PT-BR link=blue vlink=purple&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;&lt;span style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;  &lt;span lang=EN-US&gt;My recommendation for you is to start at the
TIFF format specification pdf. It has several interesting explanations that
will answer some of your questions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;  Anyway, here are some comments. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;  Yes there is no pre-defined conversion between CMYK and everything
else. It really depends on how you should interpret the K component, and this
usually involves the printer profile you are going to use.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;  Using libTIFF you can access images that are in the YCbCr color
space in its raw state or with an automatic conversion to RGB. At least in the
JPEG compression. The libtiff high level functions to load an RGB image do not
use the automatic conversion, they load the image as YCbCr and then convert the
raw data to RGB itself. By the way this is a recent change in libtiff.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;Best Regards,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;Antonio Scuri&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;span lang=EN-US style='font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'&gt;

&lt;div&gt;

&lt;div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'&gt;

&lt;p class=MsoNormal&gt;&lt;b&gt;&lt;span lang=EN-US style='font-size:10.0pt;font-family:
&quot;Tahoma&quot;,&quot;sans-serif&quot;'&gt;From:&lt;/span&gt;&lt;/b&gt;&lt;span lang=EN-US style='font-size:10.0pt;
font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;'&gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754567&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt;
[mailto:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754567&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt;] &lt;b&gt;On Behalf Of &lt;/b&gt;Gene Amtower&lt;br&gt;
&lt;b&gt;Sent:&lt;/b&gt; sexta-feira, 11 de dezembro de 2009 17:11&lt;br&gt;
&lt;b&gt;To:&lt;/b&gt; Steve Mills&lt;br&gt;
&lt;b&gt;Cc:&lt;/b&gt; tiff list&lt;br&gt;
&lt;b&gt;Subject:&lt;/b&gt; Re: [Tiff] YCbCr&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;/div&gt;

&lt;p class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;Well, I was following this thread thinking I might learn
something from the discussion, but somewhere along the way, it went off the
tracks for me!&lt;br&gt;
&lt;br&gt;
This last post confuses me because the original post mentioned that the
TIFFTAG_PHOTOMETRIC tag was reporting YCbCr, where as this one suggests the
image is in CMYK.&amp;nbsp; Are we still talking about the original image from the
first post?&amp;nbsp; If so, why is there this apparent contradiction between the
first and last post?&lt;br&gt;
&lt;br&gt;
All of this info got me to reading on the web, and I see that YCbCr is a
colorspace primarily used for signal transmission to reduce the amount of
transmission bandwidth, hence the downsampling of the Cb and Cr components
because they carry less data.&amp;nbsp; Info on Wikipedia provides conversion
formulas to/from RGB that depend on conversion factors that are not
universal.&amp;nbsp; From these formulas, a red pixel ends up generating a value in
each of the Y, Cb, and Cr pixel values because &amp;quot;Y&amp;quot; carries the
primary luminance info, while Cb and Cr only communicate a
&amp;quot;difference&amp;quot; value for the Red and Blue components.&amp;nbsp; It also
suggested to me that you can't really view YCbCr values directly because they
are calculated values used in data transmission that aren't directly related to
the RGB world that we live in.&amp;nbsp; From what I can tell, YCbCr and CMYK are completely
different colorspaces for either signal transmission or printing
(respectively), and converting from one to the other actually involves an
intermediate pass through the RGB space, with both conversions involving
variable formulas that depend on hardware-dependent and
implementation-dependent mapping algorithms.&amp;nbsp; It sounds like there is NO
universal way to convert between these three representations.&amp;nbsp; There's
also the RGBA colorspace that includes transparency info in the Alpha A channel
- does this impact YCbCr and CMYK representations at all, or is this impossible
in these alternate colorspaces?&lt;br&gt;
&lt;br&gt;
If anyone cares to enlighten me, can you help me understand this discussion on
LibTiff handling of RGB, CMYK, and YCbCr without going into a long dissertation
on images, color spaces, TVs, and printing processes?&amp;nbsp; Is it possible to
store YCbCr image data in a TIFF file?&amp;nbsp; If so, are there mechanisms built
into LibTiff to convert it automatically to RGB for viewing, or is that up to
the primary application to perform necessary conversions to the viewable
world?&amp;nbsp; With the inherent variability of YCbCr color values, how would
Steve even know if he was getting valid YCbCr data when reading the values from
the image file?&lt;br&gt;
&lt;br&gt;
I guess a quick summary of the colorspace capabilities in LibTiff and the Tiff
standard in general would be really helpful to the uninitiated among us.&amp;nbsp;
I know there's a lot of vagueness in the TIFF standard, but explain as much as
possible, please!&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp; Gene&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
On Fri, 2009-12-11 at 10:58 -0600, Steve Mills wrote: &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;pre&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;On Dec 11, 2009, at 10:15:39, Antonio Scuri wrote:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;&amp;gt;  As Joris pointed out, you actually get Y Cb and Cr planes. So the first&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;What if the file is jpeg-compressed cmyk? The TIFFTAG_PHOTOMETRIC tag says it's cmyk, not YCbCr. I expect cmyk data in this case, but it sure doesn't look correct.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;_________________________________________________________&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;Steve Mills                              Me: 952-401-6255&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;Senior Software Architect                         MultiAd&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754567&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt;                       &lt;a href=&quot;http://www.multi-ad.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;www.multi-ad.com&lt;/a&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;_______________________________________________&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754567&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style='color:black'&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26754567&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26754567.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26751067</id>
	<title>Re: YCbCr</title>
	<published>2009-12-11T12:04:35Z</published>
	<updated>2009-12-11T12:04:35Z</updated>
	<author>
		<name>Gene Amtower</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 TRANSITIONAL//EN&quot;&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
  &lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; CHARSET=UTF-8&quot;&gt;
  &lt;META NAME=&quot;GENERATOR&quot; CONTENT=&quot;GtkHTML/3.3.2&quot;&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
On Fri, 2009-12-11 at 13:22 -0600, Steve Mills wrote:
&lt;BLOCKQUOTE TYPE=CITE&gt;
&lt;PRE&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;On Dec 11, 2009, at 13:11:15, Gene Amtower wrote:&lt;/FONT&gt;

&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;gt; This last post confuses me because the original post mentioned that the TIFFTAG_PHOTOMETRIC tag was reporting YCbCr, where as this one suggests the image is in CMYK.  Are we still talking about the original image from the first post?  If so, why is there this apparent contradiction between the first and last post?&lt;/FONT&gt;

&lt;FONT COLOR=&quot;#000000&quot;&gt;The original file was in fact YCbCr. The same tester then tried creating a cmyk file and saving that as a jpeg-compressed tiff. That's the one that comes out as cmyk, but displays wrong. To further confuse you, it's only wrong if it was saved in Photoshop CS3. Save it in CS1 or CS4 and it's correct.&lt;/FONT&gt;

&lt;FONT COLOR=&quot;#000000&quot;&gt;Do the message for this list show up in the actual sent order? They do NOT for me, so it's easy to get confused about who's talking about what when.&lt;/FONT&gt;
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BR&gt;
Yes, I've been seeing them in order, and I now see in your third message that you changed to another file in CMYK!&amp;nbsp; I guess I was looking for your confirmation that you saw the right data in the YCbCr file, and I missed that the discussion switched to the CMYK file because the subject line mentioned YCbCr.&lt;BR&gt;
&lt;BR&gt;
I'll try to keep up with the big dogs from now on - or maybe I just need to stay on the porch!&lt;BR&gt;
&lt;BR&gt;
Thanks,&lt;BR&gt;
&lt;BR&gt;
&amp;nbsp;&amp;nbsp; Gene
&lt;/BODY&gt;
&lt;/HTML&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26751067&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26751067.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750687</id>
	<title>Re: JPEG compression in 3.9.2</title>
	<published>2009-12-11T11:45:26Z</published>
	<updated>2009-12-11T11:45:26Z</updated>
	<author>
		<name>Lee Howard-2</name>
	</author>
	<content type="html">Richard,
&lt;br&gt;&lt;br&gt;I'm finding a lot of problems with JPEG support in libtiff... beginning 
&lt;br&gt;with 3.7.3 all the way to 4.0.0 (including 3.9.2)... and I don't think 
&lt;br&gt;that I'm doing anything particularly fancy (i.e. simply raw-writing a 
&lt;br&gt;JPEG-compressed TIFF forces a JPEGTABLES tag to be written).
&lt;br&gt;&lt;br&gt;In the next few weeks I'll come back to the list with a set of code 
&lt;br&gt;problems that I encountered ... I hope to start up (or maybe add-to) a 
&lt;br&gt;discussion about resolving those problems. &amp;nbsp;(i.e. I'll have a patch, but 
&lt;br&gt;it will be a &amp;quot;hack&amp;quot; - someone who knows how it is supposed to be will 
&lt;br&gt;have to sign off on my fix approach or will need to rework things to 
&lt;br&gt;address the problem).
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Lee.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Richard Nolde wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Something definitely changed in the 3.9.X JPEG code. &amp;nbsp;I found that some 
&lt;br&gt;&amp;gt; of the old libtiffpic sample images cause segfaults for tiffcp, and I 
&lt;br&gt;&amp;gt; had to do some workarounds to make tiffcrop handle them at all. &amp;nbsp;Since 
&lt;br&gt;&amp;gt; OJEPG compression is now deprecated for writing images, I try to convert 
&lt;br&gt;&amp;gt; them to new JPEG compression on the fly but this is not working uniformly.
&lt;br&gt;&amp;gt; Zackthecat and Smalliz come out at half the height they should and the 
&lt;br&gt;&amp;gt; colors are way off. &amp;nbsp;The values are probably the subsampled data rather 
&lt;br&gt;&amp;gt; than the upsampled data and/or the Cb and Cr only. Quad-jpeg comes out 
&lt;br&gt;&amp;gt; OK in my working copy but looks more like a grayscale luminance map in 
&lt;br&gt;&amp;gt; the distributed copy. I'm also getting strange results, ie, several 
&lt;br&gt;&amp;gt; stripes of color but no image for ycbcr-cat.tif.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; tiffcp can no longer handle zackthecat.tif at all and smallliz aborts 
&lt;br&gt;&amp;gt; with a complaint about OJPEG not supported for writing (which is why I 
&lt;br&gt;&amp;gt; try to convert to new JPEG on the fly in tiffcrop).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I use TIFFReadEncodedStrip/Tile to avoid issues with compression 
&lt;br&gt;&amp;gt; algorithms that do not allow random seeks and I found that the 
&lt;br&gt;&amp;gt; calculated strip sizes are smaller than you would get by computing 
&lt;br&gt;&amp;gt; length * width * spp *bps/8 so I override that when I allocate buffers 
&lt;br&gt;&amp;gt; and ask for more data on the read. &amp;nbsp;For the problem images, it only 
&lt;br&gt;&amp;gt; brings back the number of bytes that it calculated, which suggests it is 
&lt;br&gt;&amp;gt; bringing back the down sampled data without up sampling it for YCbCr.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I fiddled with the JPEG_COLORMODE pseudo-tag at various points when 
&lt;br&gt;&amp;gt; writing out the data, not at load time, but it didn't solve the problem 
&lt;br&gt;&amp;gt; for these images.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Richard Nolde
&lt;br&gt;&amp;gt; TIffcrop author
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Date: Fri, 11 Dec 2009 14:15:39 -0200
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; From: &amp;quot;Antonio Scuri&amp;quot;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750687&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scuri@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Subject: Re: [Tiff] YCbCr
&lt;br&gt;&amp;gt;&amp;gt; To: &amp;quot;'Steve Mills'&amp;quot;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750687&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt;&amp;gt;,	&amp;quot;'tiff list'&amp;quot;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;As Joris pointed out, you actually get Y Cb and Cr planes. So the first
&lt;br&gt;&amp;gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But
&lt;br&gt;&amp;gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;I use libtiff 3.8.2. I have to comment the code at &amp;quot;tiff_jpeg.c&amp;quot; that does
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;downsampled_output = TRUE&amp;quot; and add &amp;quot;tif-&amp;gt;tif_flags |= TIFF_UPSAMPLED;&amp;quot; so I
&lt;br&gt;&amp;gt;&amp;gt; got all YCbCr planes at normal resolution.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;When I upgraded to libtiff 3.9.2 my code stop working. Now almost all the
&lt;br&gt;&amp;gt;&amp;gt; samples I have with YCbCr and JPEG compression fail to read. This includes
&lt;br&gt;&amp;gt;&amp;gt; the known quad-jpeg, smallliz and zackthecat.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;It is the same for libjpeg6 or libjpeg7.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;I have to investigate the changes between 3.8 and 3.9 to see if I'm not
&lt;br&gt;&amp;gt;&amp;gt; missing anything.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;BTW, I do use TIFFReadScanline and TIFFReadTile to read the image data.
&lt;br&gt;&amp;gt;&amp;gt; I'm not using the high level functions.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Best,
&lt;br&gt;&amp;gt;&amp;gt; scuri
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750687&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750687&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/JPEG-compression-in-3.9.2-tp26750087p26750687.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750668</id>
	<title>Re: JPEG compression in 3.9.2</title>
	<published>2009-12-11T11:37:50Z</published>
	<updated>2009-12-11T11:37:50Z</updated>
	<author>
		<name>Even Rouault</name>
	</author>
	<content type="html">This might be loosely related to the issues raised in the latest posts, 
&lt;br&gt;but in case it might be usefull,
&lt;br&gt;you can have a look at the following ticket :
&lt;br&gt;&lt;br&gt;2009-12-03 &amp;nbsp;Frank Warmerdam &amp;nbsp;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750668&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;warmerdam@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; * libtiff/tif_jpeg.c: Fix a couple of issues that trigger failures in
&lt;br&gt;&amp;nbsp; &amp;nbsp; some cases when using TIFFReadScanline() with JPEG compressed
&lt;br&gt;&amp;nbsp; &amp;nbsp; subsampled ycbcr images.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://bugzilla.maptools.org/show_bug.cgi?id=1936&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://bugzilla.maptools.org/show_bug.cgi?id=1936&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Richard Nolde a écrit :
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Something definitely changed in the 3.9.X JPEG code. &amp;nbsp;I found that some 
&lt;br&gt;&amp;gt; of the old libtiffpic sample images cause segfaults for tiffcp, and I 
&lt;br&gt;&amp;gt; had to do some workarounds to make tiffcrop handle them at all. &amp;nbsp;Since 
&lt;br&gt;&amp;gt; OJEPG compression is now deprecated for writing images, I try to convert 
&lt;br&gt;&amp;gt; them to new JPEG compression on the fly but this is not working uniformly.
&lt;br&gt;&amp;gt; Zackthecat and Smalliz come out at half the height they should and the 
&lt;br&gt;&amp;gt; colors are way off. &amp;nbsp;The values are probably the subsampled data rather 
&lt;br&gt;&amp;gt; than the upsampled data and/or the Cb and Cr only. Quad-jpeg comes out 
&lt;br&gt;&amp;gt; OK in my working copy but looks more like a grayscale luminance map in 
&lt;br&gt;&amp;gt; the distributed copy. I'm also getting strange results, ie, several 
&lt;br&gt;&amp;gt; stripes of color but no image for ycbcr-cat.tif.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; tiffcp can no longer handle zackthecat.tif at all and smallliz aborts 
&lt;br&gt;&amp;gt; with a complaint about OJPEG not supported for writing (which is why I 
&lt;br&gt;&amp;gt; try to convert to new JPEG on the fly in tiffcrop).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I use TIFFReadEncodedStrip/Tile to avoid issues with compression 
&lt;br&gt;&amp;gt; algorithms that do not allow random seeks and I found that the 
&lt;br&gt;&amp;gt; calculated strip sizes are smaller than you would get by computing 
&lt;br&gt;&amp;gt; length * width * spp *bps/8 so I override that when I allocate buffers 
&lt;br&gt;&amp;gt; and ask for more data on the read. &amp;nbsp;For the problem images, it only 
&lt;br&gt;&amp;gt; brings back the number of bytes that it calculated, which suggests it is 
&lt;br&gt;&amp;gt; bringing back the down sampled data without up sampling it for YCbCr.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I fiddled with the JPEG_COLORMODE pseudo-tag at various points when 
&lt;br&gt;&amp;gt; writing out the data, not at load time, but it didn't solve the problem 
&lt;br&gt;&amp;gt; for these images.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Richard Nolde
&lt;br&gt;&amp;gt; TIffcrop author
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Date: Fri, 11 Dec 2009 14:15:39 -0200
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; From: &amp;quot;Antonio Scuri&amp;quot;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750668&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scuri@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Subject: Re: [Tiff] YCbCr
&lt;br&gt;&amp;gt;&amp;gt; To: &amp;quot;'Steve Mills'&amp;quot;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750668&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt;&amp;gt;,	&amp;quot;'tiff list'&amp;quot;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;As Joris pointed out, you actually get Y Cb and Cr planes. So the first
&lt;br&gt;&amp;gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But
&lt;br&gt;&amp;gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;I use libtiff 3.8.2. I have to comment the code at &amp;quot;tiff_jpeg.c&amp;quot; that does
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;downsampled_output = TRUE&amp;quot; and add &amp;quot;tif-&amp;gt;tif_flags |= TIFF_UPSAMPLED;&amp;quot; so I
&lt;br&gt;&amp;gt;&amp;gt; got all YCbCr planes at normal resolution.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;When I upgraded to libtiff 3.9.2 my code stop working. Now almost all the
&lt;br&gt;&amp;gt;&amp;gt; samples I have with YCbCr and JPEG compression fail to read. This includes
&lt;br&gt;&amp;gt;&amp;gt; the known quad-jpeg, smallliz and zackthecat.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;It is the same for libjpeg6 or libjpeg7.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;I have to investigate the changes between 3.8 and 3.9 to see if I'm not
&lt;br&gt;&amp;gt;&amp;gt; missing anything.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;BTW, I do use TIFFReadScanline and TIFFReadTile to read the image data.
&lt;br&gt;&amp;gt;&amp;gt; I'm not using the high level functions.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Best,
&lt;br&gt;&amp;gt;&amp;gt; scuri
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750668&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750668&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/JPEG-compression-in-3.9.2-tp26750087p26750668.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750451</id>
	<title>Re: YCbCr</title>
	<published>2009-12-11T11:22:24Z</published>
	<updated>2009-12-11T11:22:24Z</updated>
	<author>
		<name>Steve Mills-2</name>
	</author>
	<content type="html">On Dec 11, 2009, at 13:11:15, Gene Amtower wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; This last post confuses me because the original post mentioned that the TIFFTAG_PHOTOMETRIC tag was reporting YCbCr, where as this one suggests the image is in CMYK. &amp;nbsp;Are we still talking about the original image from the first post? &amp;nbsp;If so, why is there this apparent contradiction between the first and last post?
&lt;br&gt;&lt;br&gt;The original file was in fact YCbCr. The same tester then tried creating a cmyk file and saving that as a jpeg-compressed tiff. That's the one that comes out as cmyk, but displays wrong. To further confuse you, it's only wrong if it was saved in Photoshop CS3. Save it in CS1 or CS4 and it's correct.
&lt;br&gt;&lt;br&gt;Do the message for this list show up in the actual sent order? They do NOT for me, so it's easy to get confused about who's talking about what when.
&lt;br&gt;&lt;br&gt;_________________________________________________________
&lt;br&gt;Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750451&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750451&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26750451.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750247</id>
	<title>Re: YCbCr</title>
	<published>2009-12-11T11:11:15Z</published>
	<updated>2009-12-11T11:11:15Z</updated>
	<author>
		<name>Gene Amtower</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 TRANSITIONAL//EN&quot;&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
  &lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; CHARSET=UTF-8&quot;&gt;
  &lt;META NAME=&quot;GENERATOR&quot; CONTENT=&quot;GtkHTML/3.3.2&quot;&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
Well, I was following this thread thinking I might learn something from the discussion, but somewhere along the way, it went off the tracks for me!&lt;BR&gt;
&lt;BR&gt;
This last post confuses me because the original post mentioned that the TIFFTAG_PHOTOMETRIC tag was reporting YCbCr, where as this one suggests the image is in CMYK.&amp;nbsp; Are we still talking about the original image from the first post?&amp;nbsp; If so, why is there this apparent contradiction between the first and last post?&lt;BR&gt;
&lt;BR&gt;
All of this info got me to reading on the web, and I see that YCbCr is a colorspace primarily used for signal transmission to reduce the amount of transmission bandwidth, hence the downsampling of the Cb and Cr components because they carry less data.&amp;nbsp; Info on Wikipedia provides conversion formulas to/from RGB that depend on conversion factors that are not universal.&amp;nbsp; From these formulas, a red pixel ends up generating a value in each of the Y, Cb, and Cr pixel values because &amp;quot;Y&amp;quot; carries the primary luminance info, while Cb and Cr only communicate a &amp;quot;difference&amp;quot; value for the Red and Blue components.&amp;nbsp; It also suggested to me that you can't really view YCbCr values directly because they are calculated values used in data transmission that aren't directly related to the RGB world that we live in.&amp;nbsp; From what I can tell, YCbCr and CMYK are completely different colorspaces for either signal transmission or printing (respectively), and converting from one to the other actually involves an intermediate pass through the RGB space, with both conversions involving variable formulas that depend on hardware-dependent and implementation-dependent mapping algorithms.&amp;nbsp; It sounds like there is NO universal way to convert between these three representations.&amp;nbsp; There's also the RGBA colorspace that includes transparency info in the Alpha A channel - does this impact YCbCr and CMYK representations at all, or is this impossible in these alternate colorspaces?&lt;BR&gt;
&lt;BR&gt;
If anyone cares to enlighten me, can you help me understand this discussion on LibTiff handling of RGB, CMYK, and YCbCr without going into a long dissertation on images, color spaces, TVs, and printing processes?&amp;nbsp; Is it possible to store YCbCr image data in a TIFF file?&amp;nbsp; If so, are there mechanisms built into LibTiff to convert it automatically to RGB for viewing, or is that up to the primary application to perform necessary conversions to the viewable world?&amp;nbsp; With the inherent variability of YCbCr color values, how would Steve even know if he was getting valid YCbCr data when reading the values from the image file?&lt;BR&gt;
&lt;BR&gt;
I guess a quick summary of the colorspace capabilities in LibTiff and the Tiff standard in general would be really helpful to the uninitiated among us.&amp;nbsp; I know there's a lot of vagueness in the TIFF standard, but explain as much as possible, please!&lt;BR&gt;
&lt;BR&gt;
Thanks,&lt;BR&gt;
&lt;BR&gt;
&amp;nbsp;&amp;nbsp; Gene&lt;BR&gt;
&lt;BR&gt;
&lt;BR&gt;
&lt;BR&gt;
On Fri, 2009-12-11 at 10:58 -0600, Steve Mills wrote:
&lt;BLOCKQUOTE TYPE=CITE&gt;
&lt;PRE&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;On Dec 11, 2009, at 10:15:39, Antonio Scuri wrote:&lt;/FONT&gt;

&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;gt;  As Joris pointed out, you actually get Y Cb and Cr planes. So the first&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.&lt;/FONT&gt;

&lt;FONT COLOR=&quot;#000000&quot;&gt;What if the file is jpeg-compressed cmyk? The TIFFTAG_PHOTOMETRIC tag says it's cmyk, not YCbCr. I expect cmyk data in this case, but it sure doesn't look correct.&lt;/FONT&gt;

&lt;FONT COLOR=&quot;#000000&quot;&gt;_________________________________________________________&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;Steve Mills                              Me: 952-401-6255&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;Senior Software Architect                         MultiAd&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750247&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt;                       &lt;A HREF=&quot;http://www.multi-ad.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;www.multi-ad.com&lt;/A&gt;&lt;/FONT&gt;


&lt;FONT COLOR=&quot;#000000&quot;&gt;_______________________________________________&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750247&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&lt;A HREF=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/A&gt;&lt;/FONT&gt;
&lt;FONT COLOR=&quot;#000000&quot;&gt;&lt;A HREF=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/A&gt;&lt;/FONT&gt;
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750247&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26750247.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26750087</id>
	<title>JPEG compression in 3.9.2</title>
	<published>2009-12-11T10:49:44Z</published>
	<updated>2009-12-11T10:49:44Z</updated>
	<author>
		<name>Richard Nolde-2</name>
	</author>
	<content type="html">Something definitely changed in the 3.9.X JPEG code. &amp;nbsp;I found that some 
&lt;br&gt;of the old libtiffpic sample images cause segfaults for tiffcp, and I 
&lt;br&gt;had to do some workarounds to make tiffcrop handle them at all. &amp;nbsp;Since 
&lt;br&gt;OJEPG compression is now deprecated for writing images, I try to convert 
&lt;br&gt;them to new JPEG compression on the fly but this is not working uniformly.
&lt;br&gt;Zackthecat and Smalliz come out at half the height they should and the 
&lt;br&gt;colors are way off. &amp;nbsp;The values are probably the subsampled data rather 
&lt;br&gt;than the upsampled data and/or the Cb and Cr only. Quad-jpeg comes out 
&lt;br&gt;OK in my working copy but looks more like a grayscale luminance map in 
&lt;br&gt;the distributed copy. I'm also getting strange results, ie, several 
&lt;br&gt;stripes of color but no image for ycbcr-cat.tif.
&lt;br&gt;&lt;br&gt;tiffcp can no longer handle zackthecat.tif at all and smallliz aborts 
&lt;br&gt;with a complaint about OJPEG not supported for writing (which is why I 
&lt;br&gt;try to convert to new JPEG on the fly in tiffcrop).
&lt;br&gt;&lt;br&gt;I use TIFFReadEncodedStrip/Tile to avoid issues with compression 
&lt;br&gt;algorithms that do not allow random seeks and I found that the 
&lt;br&gt;calculated strip sizes are smaller than you would get by computing 
&lt;br&gt;length * width * spp *bps/8 so I override that when I allocate buffers 
&lt;br&gt;and ask for more data on the read. &amp;nbsp;For the problem images, it only 
&lt;br&gt;brings back the number of bytes that it calculated, which suggests it is 
&lt;br&gt;bringing back the down sampled data without up sampling it for YCbCr.
&lt;br&gt;&lt;br&gt;I fiddled with the JPEG_COLORMODE pseudo-tag at various points when 
&lt;br&gt;writing out the data, not at load time, but it didn't solve the problem 
&lt;br&gt;for these images.
&lt;br&gt;&lt;br&gt;Richard Nolde
&lt;br&gt;TIffcrop author
&lt;br&gt;&lt;br&gt;Date: Fri, 11 Dec 2009 14:15:39 -0200
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; From: &amp;quot;Antonio Scuri&amp;quot;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750087&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;scuri@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; Subject: Re: [Tiff] YCbCr
&lt;br&gt;&amp;gt; To: &amp;quot;'Steve Mills'&amp;quot;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750087&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt;&amp;gt;,	&amp;quot;'tiff list'&amp;quot;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;As Joris pointed out, you actually get Y Cb and Cr planes. So the first
&lt;br&gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But
&lt;br&gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;I use libtiff 3.8.2. I have to comment the code at &amp;quot;tiff_jpeg.c&amp;quot; that does
&lt;br&gt;&amp;gt; &amp;quot;downsampled_output = TRUE&amp;quot; and add &amp;quot;tif-&amp;gt;tif_flags |= TIFF_UPSAMPLED;&amp;quot; so I
&lt;br&gt;&amp;gt; got all YCbCr planes at normal resolution.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;When I upgraded to libtiff 3.9.2 my code stop working. Now almost all the
&lt;br&gt;&amp;gt; samples I have with YCbCr and JPEG compression fail to read. This includes
&lt;br&gt;&amp;gt; the known quad-jpeg, smallliz and zackthecat.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;It is the same for libjpeg6 or libjpeg7.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;I have to investigate the changes between 3.8 and 3.9 to see if I'm not
&lt;br&gt;&amp;gt; missing anything.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;BTW, I do use TIFFReadScanline and TIFFReadTile to read the image data.
&lt;br&gt;&amp;gt; I'm not using the high level functions.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Best,
&lt;br&gt;&amp;gt; scuri
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;
&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26750087&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/JPEG-compression-in-3.9.2-tp26750087p26750087.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26749815</id>
	<title>Re: YCbCr</title>
	<published>2009-12-11T10:37:24Z</published>
	<updated>2009-12-11T10:37:24Z</updated>
	<author>
		<name>Antonio Scuri</name>
	</author>
	<content type="html">&amp;nbsp; &amp;nbsp;I don't think so. Because the logic will set downsampled_output to TRUE
&lt;br&gt;only if h_sampling!=1, and that happen only for YCBCR.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;If you want to debug the code, add a breakpoint at the line where
&lt;br&gt;&amp;quot;downsampled_output = FALSE;&amp;quot; in &amp;quot;tif_jpeg.c&amp;quot;. If it sets
&lt;br&gt;&amp;quot;downsampled_output = TRUE;&amp;quot; then the output is donwsampled. 
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;If you send me a sample, I can test your image here if I can read it. The
&lt;br&gt;test I have supports CMYK images.
&lt;br&gt;&lt;br&gt;Best,
&lt;br&gt;scuri
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; -----Original Message-----
&lt;br&gt;&amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26749815&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt; [mailto:tiff-
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26749815&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bounces@...&lt;/a&gt;] On Behalf Of Steve Mills
&lt;br&gt;&amp;gt; Sent: sexta-feira, 11 de dezembro de 2009 14:58
&lt;br&gt;&amp;gt; To: tiff list
&lt;br&gt;&amp;gt; Subject: Re: [Tiff] YCbCr
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Dec 11, 2009, at 10:15:39, Antonio Scuri wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;As Joris pointed out, you actually get Y Cb and Cr planes. So the
&lt;br&gt;&amp;gt; first
&lt;br&gt;&amp;gt; &amp;gt; component, that looks red, is infact Y, and indeed has the correct
&lt;br&gt;&amp;gt; size. But
&lt;br&gt;&amp;gt; &amp;gt; the Cb and Cr planes are downsampled. At least this is what I got
&lt;br&gt;&amp;gt; here.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; What if the file is jpeg-compressed cmyk? The TIFFTAG_PHOTOMETRIC tag
&lt;br&gt;&amp;gt; says it's cmyk, not YCbCr. I expect cmyk data in this case, but it sure
&lt;br&gt;&amp;gt; doesn't look correct.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _________________________________________________________
&lt;br&gt;&amp;gt; Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;&amp;gt; Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26749815&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26749815&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26749815&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26749815.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26748316</id>
	<title>Re: YCbCr</title>
	<published>2009-12-11T08:58:24Z</published>
	<updated>2009-12-11T08:58:24Z</updated>
	<author>
		<name>Steve Mills-2</name>
	</author>
	<content type="html">On Dec 11, 2009, at 10:15:39, Antonio Scuri wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp;As Joris pointed out, you actually get Y Cb and Cr planes. So the first
&lt;br&gt;&amp;gt; component, that looks red, is infact Y, and indeed has the correct size. But
&lt;br&gt;&amp;gt; the Cb and Cr planes are downsampled. At least this is what I got here.
&lt;br&gt;&lt;br&gt;What if the file is jpeg-compressed cmyk? The TIFFTAG_PHOTOMETRIC tag says it's cmyk, not YCbCr. I expect cmyk data in this case, but it sure doesn't look correct.
&lt;br&gt;&lt;br&gt;_________________________________________________________
&lt;br&gt;Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26748316&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26748316&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26748316.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26747514</id>
	<title>Re: YCbCr</title>
	<published>2009-12-11T08:15:39Z</published>
	<updated>2009-12-11T08:15:39Z</updated>
	<author>
		<name>Antonio Scuri</name>
	</author>
	<content type="html">&amp;nbsp; As Joris pointed out, you actually get Y Cb and Cr planes. So the first
&lt;br&gt;component, that looks red, is infact Y, and indeed has the correct size. But
&lt;br&gt;the Cb and Cr planes are downsampled. At least this is what I got here.
&lt;br&gt;&lt;br&gt;&amp;nbsp; I use libtiff 3.8.2. I have to comment the code at &amp;quot;tiff_jpeg.c&amp;quot; that does
&lt;br&gt;&amp;quot;downsampled_output = TRUE&amp;quot; and add &amp;quot;tif-&amp;gt;tif_flags |= TIFF_UPSAMPLED;&amp;quot; so I
&lt;br&gt;got all YCbCr planes at normal resolution.
&lt;br&gt;&lt;br&gt;&amp;nbsp; When I upgraded to libtiff 3.9.2 my code stop working. Now almost all the
&lt;br&gt;samples I have with YCbCr and JPEG compression fail to read. This includes
&lt;br&gt;the known quad-jpeg, smallliz and zackthecat. 
&lt;br&gt;&lt;br&gt;&amp;nbsp; It is the same for libjpeg6 or libjpeg7.
&lt;br&gt;&lt;br&gt;&amp;nbsp; I have to investigate the changes between 3.8 and 3.9 to see if I'm not
&lt;br&gt;missing anything.
&lt;br&gt;&lt;br&gt;&amp;nbsp; BTW, I do use TIFFReadScanline and TIFFReadTile to read the image data.
&lt;br&gt;I'm not using the high level functions.
&lt;br&gt;&lt;br&gt;Best,
&lt;br&gt;scuri
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; -----Original Message-----
&lt;br&gt;&amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26747514&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt; [mailto:tiff-
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26747514&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bounces@...&lt;/a&gt;] On Behalf Of Steve Mills
&lt;br&gt;&amp;gt; Sent: quinta-feira, 10 de dezembro de 2009 18:31
&lt;br&gt;&amp;gt; To: tiff list
&lt;br&gt;&amp;gt; Subject: Re: [Tiff] YCbCr
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Dec 10, 2009, at 14:21:08, Antonio Scuri wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;When loading YCbCr colorspace from JPEG compressed images I had a
&lt;br&gt;&amp;gt; problem
&lt;br&gt;&amp;gt; &amp;gt; with the size of the returned images. The logic in &amp;quot;tiff_jpeg.c&amp;quot;
&lt;br&gt;&amp;gt; returns a
&lt;br&gt;&amp;gt; &amp;gt; downsampled image. I fixed it changing the code so it returns a
&lt;br&gt;&amp;gt; normal size
&lt;br&gt;&amp;gt; &amp;gt; image. Let me know if you are interested.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; In what way was it downsamples? Can you give an example? The one test
&lt;br&gt;&amp;gt; file I just tried looks like the correct size (it's an all red image).
&lt;br&gt;&amp;gt; We're asking for the tags we're interested in and reading it row by
&lt;br&gt;&amp;gt; row. Is this different from how you're loading tiff's?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _________________________________________________________
&lt;br&gt;&amp;gt; Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;&amp;gt; Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26747514&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26747514&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26747514&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26747514.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26736014</id>
	<title>Re: YCbCr</title>
	<published>2009-12-10T14:31:54Z</published>
	<updated>2009-12-10T14:31:54Z</updated>
	<author>
		<name>Steve Mills-2</name>
	</author>
	<content type="html">I used the dump function to see what the differences between the jpeg-compressed cmyk files might be. Here's the output for the file saved in Photoshop CS3, the one that produces incorrect results:
&lt;br&gt;&lt;br&gt;TIFFSetField: dummy: Unknown pseudo-tag 65538.
&lt;br&gt;Magic: 0x4d4d &amp;lt;big-endian&amp;gt; Version: 0x2a
&lt;br&gt;Directory 0: offset 8 (0x8) next 0 (0)
&lt;br&gt;SubFileType (254) LONG (4) 1&amp;lt;0&amp;gt;
&lt;br&gt;ImageWidth (256) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;ImageLength (257) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;BitsPerSample (258) SHORT (3) 4&amp;lt;8 8 8 8&amp;gt;
&lt;br&gt;Compression (259) SHORT (3) 1&amp;lt;7&amp;gt;
&lt;br&gt;Photometric (262) SHORT (3) 1&amp;lt;5&amp;gt;
&lt;br&gt;StripOffsets (273) LONG (4) 1&amp;lt;25360&amp;gt;
&lt;br&gt;Orientation (274) SHORT (3) 1&amp;lt;1&amp;gt;
&lt;br&gt;SamplesPerPixel (277) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;RowsPerStrip (278) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;StripByteCounts (279) LONG (4) 1&amp;lt;128&amp;gt;
&lt;br&gt;XResolution (282) RATIONAL (5) 1&amp;lt;72&amp;gt;
&lt;br&gt;YResolution (283) RATIONAL (5) 1&amp;lt;72&amp;gt;
&lt;br&gt;PlanarConfig (284) SHORT (3) 1&amp;lt;1&amp;gt;
&lt;br&gt;ResolutionUnit (296) SHORT (3) 1&amp;lt;2&amp;gt;
&lt;br&gt;Software (305) ASCII (2) 30&amp;lt;Adobe Photoshop CS3 Maci ...&amp;gt;
&lt;br&gt;DateTime (306) ASCII (2) 20&amp;lt;2009:12:10 15:08:12\0&amp;gt;
&lt;br&gt;JPEGTables (347) UNDEFINED (7) 558&amp;lt;0xff 0xd8 0xff 0xdb 00 0x84 00 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x3 0x2 0x2 0x2 0x3 0x4 0x3 ...&amp;gt;
&lt;br&gt;700 (0x2bc) BYTE (1) 15890&amp;lt;0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...&amp;gt;
&lt;br&gt;33723 (0x83bb) LONG (4) 2&amp;lt;469893120 33554432&amp;gt;
&lt;br&gt;34377 (0x8649) BYTE (1) 8552&amp;lt;0x38 0x42 0x49 0x4d 0x4 0x4 00 00 00 00 00 0x7 0x1c 0x2 00 00 0x2 00 00 00 0x38 0x42 0x49 0x4d ...&amp;gt;
&lt;br&gt;34665 (0x8769) LONG (4) 1&amp;lt;25488&amp;gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;And here's the file from CS4, which produces correct results:
&lt;br&gt;&lt;br&gt;TIFFSetField: dummy: Unknown pseudo-tag 65538.
&lt;br&gt;Magic: 0x4d4d &amp;lt;big-endian&amp;gt; Version: 0x2a
&lt;br&gt;Directory 0: offset 8 (0x8) next 0 (0)
&lt;br&gt;SubFileType (254) LONG (4) 1&amp;lt;0&amp;gt;
&lt;br&gt;ImageWidth (256) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;ImageLength (257) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;BitsPerSample (258) SHORT (3) 4&amp;lt;8 8 8 8&amp;gt;
&lt;br&gt;Compression (259) SHORT (3) 1&amp;lt;7&amp;gt;
&lt;br&gt;Photometric (262) SHORT (3) 1&amp;lt;5&amp;gt;
&lt;br&gt;StripOffsets (273) LONG (4) 1&amp;lt;18814&amp;gt;
&lt;br&gt;Orientation (274) SHORT (3) 1&amp;lt;1&amp;gt;
&lt;br&gt;SamplesPerPixel (277) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;RowsPerStrip (278) SHORT (3) 1&amp;lt;4&amp;gt;
&lt;br&gt;StripByteCounts (279) LONG (4) 1&amp;lt;117&amp;gt;
&lt;br&gt;XResolution (282) RATIONAL (5) 1&amp;lt;72&amp;gt;
&lt;br&gt;YResolution (283) RATIONAL (5) 1&amp;lt;72&amp;gt;
&lt;br&gt;PlanarConfig (284) SHORT (3) 1&amp;lt;1&amp;gt;
&lt;br&gt;ResolutionUnit (296) SHORT (3) 1&amp;lt;2&amp;gt;
&lt;br&gt;Software (305) ASCII (2) 30&amp;lt;Adobe Photoshop CS4 Maci ...&amp;gt;
&lt;br&gt;DateTime (306) ASCII (2) 20&amp;lt;2009:12:10 14:35:21\0&amp;gt;
&lt;br&gt;JPEGTables (347) UNDEFINED (7) 285&amp;lt;0xff 0xd8 0xff 0xdb 00 0x43 00 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x2 0x3 0x2 0x2 0x2 0x3 0x4 0x3 ...&amp;gt;
&lt;br&gt;700 (0x2bc) BYTE (1) 15863&amp;lt;0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...&amp;gt;
&lt;br&gt;34377 (0x8649) BYTE (1) 2324&amp;lt;0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 00 00 00 00 00 00 00 00 00 00 00 00 ...&amp;gt;
&lt;br&gt;34665 (0x8769) LONG (4) 1&amp;lt;18932&amp;gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;The StripOffsets and StripByteCounts are different, as are the JPEGTables. I certainly don't understand any of that, but shouldn't we expect the same row data for each row read?
&lt;br&gt;&lt;br&gt;_________________________________________________________
&lt;br&gt;Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736014&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26736014&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26736014.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26734626</id>
	<title>Re: YCbCr</title>
	<published>2009-12-10T12:55:30Z</published>
	<updated>2009-12-10T12:55:30Z</updated>
	<author>
		<name>Steve Mills-2</name>
	</author>
	<content type="html">On Dec 10, 2009, at 14:32:14, Joris Van Damme (AWare Systems) wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; It does, in the sense that it is LibTiff's wrong way to try and support the result that you're after in this particular case. Do thorough testing, and if it works for you, it works for you.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; So, what you were getting was not channel-order-inversed RGB, but YCbCr, actually. And that is what the Photometric said you'd get. Only if the Photometric is YCbCr, and the compression is JPEG, can you suddenly turn this into RGB by using this magical out-of-the-blue pseudo-tag. But you'll have to remember to have your code thoroughly check for these conditions, and use the magical pseudo-tag.
&lt;br&gt;&lt;br&gt;So you're saying I can NOT just ALWAYS set this tag? I tried setting it only after reading had begin and we were reading tags to get color space, pixel size, etc, but it did not work. Moving the tag-setting to right after TIFFClientOpen made it work. Are you saying that we will get incorrect results for other cases that are NOT YCbCr jpeg-compressed?
&lt;br&gt;&lt;br&gt;The same tester just sent me a cymk jpeg-compressed tiff (PC byte order, created in Photoshop CS3). It is showing up wrong. Each pixel should be cmyk 0%,99%,99%,0% (that's what I see in Photoshop - the entire file is red, not a great test file, but that's what he sent), but the hex values I see for each pixel are 4d,55,ff,00 after we call TIFFReadScanline.
&lt;br&gt;&lt;br&gt;I tried making my own test document in Photoshop CS4, but my files are showing up correctly. They're much smaller and contain pixels colored cyan, magenta, yellow, and black.
&lt;br&gt;&lt;br&gt;_________________________________________________________
&lt;br&gt;Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734626&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734626&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26734626.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26734407</id>
	<title>Re: YCbCr</title>
	<published>2009-12-10T12:32:14Z</published>
	<updated>2009-12-10T12:32:14Z</updated>
	<author>
		<name>Joris Van Damme (AWare Systems)-2</name>
	</author>
	<content type="html">Steve,
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; Are you using the JPEG_COLORMODE pseudo-tag?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; No. But I just added this call right after our call to TIFFClientOpen and 
&lt;br&gt;&amp;gt; it worked!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; TIFFSetField(m_TIFF, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Is that the correct way to handle this?
&lt;br&gt;&lt;br&gt;It does, in the sense that it is LibTiff's wrong way to try and support the 
&lt;br&gt;result that you're after in this particular case. Do thorough testing, and 
&lt;br&gt;if it works for you, it works for you.
&lt;br&gt;&lt;br&gt;So, what you were getting was not channel-order-inversed RGB, but YCbCr, 
&lt;br&gt;actually. And that is what the Photometric said you'd get. Only if the 
&lt;br&gt;Photometric is YCbCr, and the compression is JPEG, can you suddenly turn 
&lt;br&gt;this into RGB by using this magical out-of-the-blue pseudo-tag. But you'll 
&lt;br&gt;have to remember to have your code thoroughly check for these conditions, 
&lt;br&gt;and use the magical pseudo-tag.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Best regards,
&lt;br&gt;&lt;br&gt;Joris
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734407&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26734407.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26734384</id>
	<title>Re: YCbCr</title>
	<published>2009-12-10T12:31:02Z</published>
	<updated>2009-12-10T12:31:02Z</updated>
	<author>
		<name>Steve Mills-2</name>
	</author>
	<content type="html">On Dec 10, 2009, at 14:21:08, Antonio Scuri wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp;When loading YCbCr colorspace from JPEG compressed images I had a problem
&lt;br&gt;&amp;gt; with the size of the returned images. The logic in &amp;quot;tiff_jpeg.c&amp;quot; returns a
&lt;br&gt;&amp;gt; downsampled image. I fixed it changing the code so it returns a normal size
&lt;br&gt;&amp;gt; image. Let me know if you are interested.
&lt;br&gt;&lt;br&gt;In what way was it downsamples? Can you give an example? The one test file I just tried looks like the correct size (it's an all red image). We're asking for the tags we're interested in and reading it row by row. Is this different from how you're loading tiff's?
&lt;br&gt;&lt;br&gt;_________________________________________________________
&lt;br&gt;Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734384&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734384&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26734384.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26734365</id>
	<title>Re: YCbCr</title>
	<published>2009-12-10T12:21:08Z</published>
	<updated>2009-12-10T12:21:08Z</updated>
	<author>
		<name>Antonio Scuri</name>
	</author>
	<content type="html">&amp;nbsp; When loading YCbCr colorspace from JPEG compressed images I had a problem
&lt;br&gt;with the size of the returned images. The logic in &amp;quot;tiff_jpeg.c&amp;quot; returns a
&lt;br&gt;downsampled image. I fixed it changing the code so it returns a normal size
&lt;br&gt;image. Let me know if you are interested.
&lt;br&gt;&lt;br&gt;Best Regards,
&lt;br&gt;Antonio Scuri
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; -----Original Message-----
&lt;br&gt;&amp;gt; From: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734365&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tiff-bounces@...&lt;/a&gt; [mailto:tiff-
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734365&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bounces@...&lt;/a&gt;] On Behalf Of Steve Mills
&lt;br&gt;&amp;gt; Sent: quinta-feira, 10 de dezembro de 2009 17:37
&lt;br&gt;&amp;gt; To: tiff list
&lt;br&gt;&amp;gt; Subject: Re: [Tiff] YCbCr
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Dec 10, 2009, at 13:19:35, Joris Van Damme (AWare Systems) wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; Are you using the JPEG_COLORMODE pseudo-tag?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; No. But I just added this call right after our call to TIFFClientOpen
&lt;br&gt;&amp;gt; and it worked!
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; TIFFSetField(m_TIFF, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Is that the correct way to handle this?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _________________________________________________________
&lt;br&gt;&amp;gt; Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;&amp;gt; Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734365&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734365&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26734365&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26734365.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26733477</id>
	<title>Re: YCbCr</title>
	<published>2009-12-10T11:37:16Z</published>
	<updated>2009-12-10T11:37:16Z</updated>
	<author>
		<name>Steve Mills-2</name>
	</author>
	<content type="html">On Dec 10, 2009, at 13:19:35, Joris Van Damme (AWare Systems) wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Are you using the JPEG_COLORMODE pseudo-tag?
&lt;br&gt;&lt;br&gt;No. But I just added this call right after our call to TIFFClientOpen and it worked!
&lt;br&gt;&lt;br&gt;TIFFSetField(m_TIFF, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
&lt;br&gt;&lt;br&gt;Is that the correct way to handle this?
&lt;br&gt;&lt;br&gt;_________________________________________________________
&lt;br&gt;Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26733477&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26733477&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26733477.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26733012</id>
	<title>Re: YCbCr</title>
	<published>2009-12-10T11:19:35Z</published>
	<updated>2009-12-10T11:19:35Z</updated>
	<author>
		<name>Joris Van Damme (AWare Systems)-2</name>
	</author>
	<content type="html">Steve,
&lt;br&gt;&lt;br&gt;&amp;gt; What should I expect to be get from a call to TIFFReadScanline when the 
&lt;br&gt;&amp;gt; TIFFTAG_PHOTOMETRIC tag is PHOTOMETRIC_YCBCR? It appears that we're 
&lt;br&gt;&amp;gt; getting rgb, but in the wrong channel order (should be rgb, but is bgr or 
&lt;br&gt;&amp;gt; vise versa). I only have one test document that is supposed to be solid 
&lt;br&gt;&amp;gt; red. It's coming out blue. I don't know how the file was made or how to 
&lt;br&gt;&amp;gt; make another one, otherwise I'd use a file with more colors so I knew for 
&lt;br&gt;&amp;gt; sure what was going on.
&lt;br&gt;&lt;br&gt;Are you using the JPEG_COLORMODE pseudo-tag?
&lt;br&gt;&lt;br&gt;It may also be related to a define in LibJpeg, that specifies the channel 
&lt;br&gt;order of RGB. It may be that in your own copy of LibJpeg, that define is 
&lt;br&gt;tuned, whilst LibTiff does not expect that. I don't remember from the top of 
&lt;br&gt;my head the name of the define, but it should be straightforward to find it 
&lt;br&gt;in a LibJpeg config file.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Best regards,
&lt;br&gt;&lt;br&gt;Joris
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26733012&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26733012.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26732362</id>
	<title>YCbCr</title>
	<published>2009-12-10T10:28:31Z</published>
	<updated>2009-12-10T10:28:31Z</updated>
	<author>
		<name>Steve Mills-2</name>
	</author>
	<content type="html">What should I expect to be get from a call to TIFFReadScanline when the TIFFTAG_PHOTOMETRIC tag is PHOTOMETRIC_YCBCR? It appears that we're getting rgb, but in the wrong channel order (should be rgb, but is bgr or vise versa). I only have one test document that is supposed to be solid red. It's coming out blue. I don't know how the file was made or how to make another one, otherwise I'd use a file with more colors so I knew for sure what was going on.
&lt;br&gt;&lt;br&gt;_________________________________________________________
&lt;br&gt;Steve Mills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me: 952-401-6255
&lt;br&gt;Senior Software Architect &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MultiAd
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26732362&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;smills@...&lt;/a&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; www.multi-ad.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26732362&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/YCbCr-tp26732362p26732362.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26706620</id>
	<title>Re: Problems with multiple strip G4 to single strip G4 tiff.</title>
	<published>2009-12-09T00:11:44Z</published>
	<updated>2009-12-09T00:11:44Z</updated>
	<author>
		<name>Juergen Buchmueller</name>
	</author>
	<content type="html">On Wed, 9 Dec 2009 02:47:52 -0500
&lt;br&gt;Phillip Wiles &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26706620&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pwiles38@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; I am 99.9% certain that it is my code that is causing the crash. I should
&lt;br&gt;&amp;gt; have been clearer on that.
&lt;br&gt;&lt;br&gt;Ok, I thought you had checked that :)
&lt;br&gt;&lt;br&gt;&amp;gt; I downloaded GDB and it looks interesting, but it's likely overkill for this
&lt;br&gt;&amp;gt; problem and likely over my head.
&lt;br&gt;&lt;br&gt;Nah, it's dead simple. Let your program write a coredump (perhaps
&lt;br&gt;setting &amp;quot;ulimit -c unlimited&amp;quot; before), then run &amp;quot;gdb
&lt;br&gt;path/to/your/program xyz.core&amp;quot; and do a &amp;quot;bt&amp;quot; for backtrace. If you
&lt;br&gt;compiled your code with symbols (-g option of gcc) you'll see on which
&lt;br&gt;line it was.
&lt;br&gt;&lt;br&gt;&amp;gt; I'm not asking that anyone do the work for me. I'm looking for direction (or
&lt;br&gt;&amp;gt; explanation as to what I'm doing wrong) to the correct way to save the image
&lt;br&gt;&amp;gt; a single strip, when the original image was multiple strip.
&lt;br&gt;&lt;br&gt;I thought you wanted to do it the other way round? Anyway, here's a
&lt;br&gt;code snippet from my libtiff usage, omitting the setting of all the
&lt;br&gt;other necessary tags:
&lt;br&gt;&lt;br&gt;/* write a striped image */
&lt;br&gt;rowsperstrip = TIFFDefaultStripSize(hTIFF, fmt-&amp;gt;image_length);
&lt;br&gt;if (rowsperstrip &amp;gt; fmt-&amp;gt;image_length) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rowsperstrip = fmt-&amp;gt;image_length;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG(LINFO,(_fun,&amp;quot;clamping to image length: %u\n&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rowsperstrip));
&lt;br&gt;}
&lt;br&gt;rc = TIFFSetField(hTIFF, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
&lt;br&gt;for (y = 0; y &amp;lt; fmt-&amp;gt;image_length; y++) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tdata_t row = (tdata_t)(tiff-&amp;gt;mem.data + y * tiff-&amp;gt;stride + x);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rc = TIFFWriteScanline(hTIFF, row, y, 0);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (rc != 1) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LOG(LERROR,(_fun,&amp;quot;TIFFWriteScanline(%p,%p,%d,%d) &amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;failed (%d)\n&amp;quot;, tiff, row, y, 0, rc));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; goto abort;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;HTH,
&lt;br&gt;Juergen
&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26706620&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problems-with-multiple-strip-G4-to-single-strip-G4-tiff.-tp26679519p26706620.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26706354</id>
	<title>Re: Problems with multiple strip G4 to single strip G4 tiff.</title>
	<published>2009-12-08T23:47:52Z</published>
	<updated>2009-12-08T23:47:52Z</updated>
	<author>
		<name>Phillip Wiles</name>
	</author>
	<content type="html">&lt;div class=&quot;gmail_quote&quot;&gt;On Tue, Dec 8, 2009 at 1:11 PM, Juergen Buchmueller wrote:&lt;br&gt;
&lt;blockquote style=&quot;BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex&quot; class=&quot;gmail_quote&quot;&gt;
&lt;div class=&quot;im&quot;&gt;&lt;br&gt;&amp;gt; But when I try to write an image that started out as multiple strips it crashes.&lt;br&gt;&lt;br&gt;&lt;/div&gt;Did you verify it crashes in libtiff, not in your code? I.e. use a&lt;br&gt;coredump and GDB or the debugger on Windows.&lt;br&gt;
&lt;br&gt;Juergen&lt;br&gt;&lt;/blockquote&gt;
&lt;div&gt;I am 99.9% certain that it is my code that is causing the crash. I should have been clearer on that. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I downloaded GDB and it looks interesting, but it&amp;#39;s likely overkill for this problem and likely over my head.&lt;br&gt; &lt;br&gt;I&amp;#39;m not asking that anyone do the work for me. I&amp;#39;m looking for direction (or explanation as to what I&amp;#39;m doing wrong) to the correct way to save the image a single strip, when the original image was multiple strip. I have searched the mail list archive at length and searched on Google. But unfortunately there really isn&amp;#39;t that much in the way of examples (the IBM articles, “Using LibTIFF” and tons of reposted LibTIFF manuals). I really hoped and tried to avoid posting to the mail list, to get help. The only other opinion really left is to dig around in the source code of tiffcp and see if I can get the answer/understanding there. &lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26706354&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problems-with-multiple-strip-G4-to-single-strip-G4-tiff.-tp26679519p26706354.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26698244</id>
	<title>Re: Problems with multiple strip G4 to single strip G4 tiff.</title>
	<published>2009-12-08T10:11:24Z</published>
	<updated>2009-12-08T10:11:24Z</updated>
	<author>
		<name>Juergen Buchmueller</name>
	</author>
	<content type="html">On Mon, 7 Dec 2009 11:06:24 -0500
&lt;br&gt;Phillip Wiles &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26698244&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pwiles38@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; But when I try to write an image that started out as multiple strips it crashes.
&lt;br&gt;&lt;br&gt;Did you verify it crashes in libtiff, not in your code? I.e. use a
&lt;br&gt;coredump and GDB or the debugger on Windows.
&lt;br&gt;&lt;br&gt;Juergen
&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26698244&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problems-with-multiple-strip-G4-to-single-strip-G4-tiff.-tp26679519p26698244.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26698029</id>
	<title>Re: Problems with multiple strip G4 to single strip G4 tiff.</title>
	<published>2009-12-08T09:53:13Z</published>
	<updated>2009-12-08T09:53:13Z</updated>
	<author>
		<name>Phillip Wiles</name>
	</author>
	<content type="html">&lt;div&gt;Phillip wrote:&lt;/div&gt;
&lt;div class=&quot;gmail_quote&quot;&gt;
&lt;blockquote style=&quot;BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex&quot; class=&quot;gmail_quote&quot;&gt;  
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;If I use this below to write a tiff that started as single strip tiff, there is no problem. But when I try to write an image that started out &lt;br&gt;as multiple strips it crashes. Do I &amp;quot;need&amp;quot; to save the image multiple strips? And if I do, can someone help in the right direction (I have experimented to try and force multiple strips with a group 4 image, with no luck). &lt;br&gt;
&lt;br&gt;TIFFSetField(out,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);&lt;br&gt;if(mbCompression){TIFFSetField(tif, TIFFTAG_COMPRESSION, mTiffCompression);}; &lt;br&gt;if(mbSubfileType){TIFFSetField(tif, TIFFTAG_SUBFILETYPE, muliSubfileType);}; &lt;/div&gt;

&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;if(mbResolutionUnit){TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, musiResolutionUnit);}; &lt;br&gt;if(mbXResolution){TIFFSetField(tif, TIFFTAG_XRESOLUTION, mfTiffXresolution);}; &lt;br&gt;
if(mbYResolution){TIFFSetField(tif, TIFFTAG_YRESOLUTION, mfTiffYresolution);}; &lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;if(mbImageWidth){TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, muliImageWidth);}; &lt;br&gt;if(mbImageLength){TIFFSetField(tif, TIFFTAG_IMAGELENGTH, muliImageHeight);}; &lt;/div&gt;

&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;if(mbPhotometricInterpretation){TIFFSetField(tif, TIFFTAG_PHOTOMETRIC ,musiPhotoMetric);}; &lt;br&gt;if(mbBitsPerSample){TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE ,musiBitPerSample);}; &lt;br&gt;
if(mbFillOrder){TIFFSetField(tif, TIFFTAG_FILLORDER, musiFillOrder);}; &lt;br&gt;if(mbSamplesPerPixel){TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, musiSamplePerPixel);}; &lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt; &lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;if(mbuf){TIFFWriteEncodedStrip(tif, 0, mbuf, (muliImageWidth * muliImageHeight) / 8);}; &lt;br&gt;&lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;//My attempt at creating multiple strip.&lt;br&gt;//if(mbRowsPerStrip){TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, muliRowsPerStrip);}; &lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;//tdata_t outbuf;&lt;br&gt;//char * p = (char*)mbuf;&lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt;//for(tstrip_t counter = 0; counter &amp;lt; mstrip; counter++){&lt;br&gt;//   outbuf = (void*)&amp;amp;p[counter * (muliImageWidth * muliRowsPerStrip)/8];&lt;br&gt;//   TIFFWriteEncodedStrip(out, counter, outbuf, (muliImageWidth * muliRowsPerStrip)/8);&lt;br&gt;
//};&lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot;&gt; &lt;/div&gt;&lt;/blockquote&gt;
&lt;div&gt;
&lt;div&gt;I have changed the save to:&lt;/div&gt;
&lt;div&gt;if(mbuf){TIFFWriteEncodedStrip(out, 0, mbuf, mBufferSize);};&lt;/div&gt;
&lt;div&gt;This gives me a black (or all white depending on program used to read it) image as output from a multiple strip original image. A single strip original image still works without problems. Both images are Group 4 (I can post the data from AsTiffTagViewer, if that will help any).&lt;/div&gt;

&lt;div&gt; &lt;/div&gt;
&lt;div&gt;This is my read (which is for the most part the same as the one shown in the &amp;quot;Using the TIFF Library&amp;quot;)&lt;br&gt;mstrip = TIFFNumberOfStrips(tif);&lt;br&gt;mBufferSize = TIFFStripSize(tif);&lt;br&gt;mbuf = _TIFFmalloc(mBufferSize);&lt;br&gt;
mstrip = TIFFNumberOfStrips(tif); &lt;br&gt;for (tstrip_t tempstrip = 0; tempstrip &amp;lt; mstrip; tempstrip++){&lt;br&gt; TIFFReadEncodedStrip(tif, tempstrip, mbuf, (tsize_t) -1);&lt;br&gt;};&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I&amp;#39;m using LibTIFF 3.8.2&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26698029&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problems-with-multiple-strip-G4-to-single-strip-G4-tiff.-tp26679519p26698029.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26685171</id>
	<title>Re: TIFFTAG_RICHTIFFIPTC vs my life...</title>
	<published>2009-12-07T14:14:11Z</published>
	<updated>2009-12-07T14:14:11Z</updated>
	<author>
		<name>Tom Welsh</name>
	</author>
	<content type="html">I feel your pain. When I load a TIFF that was written by Photoshop, &amp;nbsp;I get the warning, &amp;quot;wrong data type 7 for &amp;quot;RichTIFFIPTC&amp;quot;; tag ignored&amp;quot;. Have you found any way to deal with this?
&lt;br&gt;&lt;br&gt;Tom
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Chris Losinger wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;and by OkToChangeTag, i meant _TIFFFindFieldInfo.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sorry. :)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;problem remains the same, however.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-c
&lt;br&gt;&lt;br&gt;At 12:38 PM 9/24/2009, Chris Losinger wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;..
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I can kindof see a way to do it - starting by teaching the 'wrong
&lt;br&gt;&amp;gt;data type' check in TIFFReadDirectory to allow the exception; but
&lt;br&gt;&amp;gt;then OkToChangeTag tells TIFFVSetField to use the built-in type for
&lt;br&gt;&amp;gt;that tag (TIFF_LONG instead of TIFF_UNDEFINIED), and that means all
&lt;br&gt;&amp;gt;the mallocs and memcpys which follow are too large by a factor of 4.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Without teaching OkToChangeTag about the exception, and then finding
&lt;br&gt;&amp;gt;the next snag, which could take forever, I was hoping to see that
&lt;br&gt;&amp;gt;someone else had found a solid solution to the problem and would be
&lt;br&gt;&amp;gt;willing to share...
&lt;br&gt;&lt;br&gt;----
&lt;br&gt;Chris Losinger
&lt;br&gt;losinger@earthlink.net
&lt;br&gt;smallest@smalleranimals.com &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.smalleranimals.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.smalleranimals.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: Tiff@lists.maptools.org
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/TIFFTAG_RICHTIFFIPTC-vs-my-life...-tp25598608p26685171.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26681432</id>
	<title>Re: Full strip allocation in TIFFWriteScanline</title>
	<published>2009-12-07T10:01:40Z</published>
	<updated>2009-12-07T10:01:40Z</updated>
	<author>
		<name>Frank Warmerdam-2</name>
	</author>
	<content type="html">Lars Uebernickel wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; TIFFWriteScanline always allocates memory for a complete strip. &amp;nbsp;When
&lt;br&gt;&amp;gt; writing large TIFF files in a single strip, this can lead to memory
&lt;br&gt;&amp;gt; problems quickly.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I am aware that the whole point of dividing the image data into strips
&lt;br&gt;&amp;gt; is to be able to read and write in manageable chunks of memory.
&lt;br&gt;&amp;gt; However, some applications (e.g. many fax applications) seem to have
&lt;br&gt;&amp;gt; problems with TIFF images with more than a single strip.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I am aware of libtiff's strip-based API, which is capable of writing
&lt;br&gt;&amp;gt; strip data incrementally with TIFFWriteRawStrip. &amp;nbsp;Unfortunately, it
&lt;br&gt;&amp;gt; expects already compressed data and is therefore not making use of the
&lt;br&gt;&amp;gt; built-in compressors. &amp;nbsp;TIFFWriteEncodedStrip on the other hand
&lt;br&gt;&amp;gt; compresses data prior to writing it, but it doesn't work incrementally,
&lt;br&gt;&amp;gt; i.e. it expects the full data of each strip.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I assume that this is because libtiff's implementation of the
&lt;br&gt;&amp;gt; compression algorithms cannot operate on streamed data? &amp;nbsp;I think it'd
&lt;br&gt;&amp;gt; make sense to support this, as the data which needs to be buffered by
&lt;br&gt;&amp;gt; most compression schemes should be substantially less (and never more)
&lt;br&gt;&amp;gt; than the smallest strip size feasible for each algorithm.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; What are you general thoughts on changing the compression
&lt;br&gt;&amp;gt; implementations in this regard? &amp;nbsp;Do you think it is doable or am I
&lt;br&gt;&amp;gt; overlooking something? &amp;nbsp;Is somebody already working on it or planning
&lt;br&gt;&amp;gt; to?
&lt;/div&gt;&lt;br&gt;Lars,
&lt;br&gt;&lt;br&gt;I inspected the tif_packbits.c code (because it is one of the simplier
&lt;br&gt;encoders) and it *appears* to me that it ought to support writing a scanline
&lt;br&gt;at a time without buffering the whole output strip. &amp;nbsp;I PackBitsEncode appears
&lt;br&gt;to be structured to handle a scanline at a time and it calls TIFFFlushData1()
&lt;br&gt;periodically - presumably to flush out the data compressed so far.
&lt;br&gt;&lt;br&gt;I haven't looked any further, and I must confess to some confusion about the
&lt;br&gt;assumptions and expectations for encoders and decoders despite having fiddled
&lt;br&gt;with them for years. &amp;nbsp;But it seems to me that at least some encoders support
&lt;br&gt;scanline oriented encoding and writing to disk. &amp;nbsp;So if the fax encoders do not,
&lt;br&gt;we can consider it a task local to the fax encoder to improve it to do the
&lt;br&gt;same.
&lt;br&gt;&lt;br&gt;Of course, I may be missing lots of things.
&lt;br&gt;&lt;br&gt;Best regards,
&lt;br&gt;-- 
&lt;br&gt;---------------------------------------+--------------------------------------
&lt;br&gt;I set the clouds in motion - turn up &amp;nbsp; | Frank Warmerdam, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26681432&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;warmerdam@...&lt;/a&gt;
&lt;br&gt;light and sound - activate the windows | &lt;a href=&quot;http://pobox.com/~warmerdam&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://pobox.com/~warmerdam&lt;/a&gt;&lt;br&gt;and watch the world go round - Rush &amp;nbsp; &amp;nbsp;| Geospatial Programmer for Rent
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26681432&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Full-strip-allocation-in-TIFFWriteScanline-tp26680132p26681432.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26680132</id>
	<title>Full strip allocation in TIFFWriteScanline</title>
	<published>2009-12-07T08:47:27Z</published>
	<updated>2009-12-07T08:47:27Z</updated>
	<author>
		<name>Lars Uebernickel</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;TIFFWriteScanline always allocates memory for a complete strip. &amp;nbsp;When
&lt;br&gt;writing large TIFF files in a single strip, this can lead to memory
&lt;br&gt;problems quickly.
&lt;br&gt;&lt;br&gt;I am aware that the whole point of dividing the image data into strips
&lt;br&gt;is to be able to read and write in manageable chunks of memory.
&lt;br&gt;However, some applications (e.g. many fax applications) seem to have
&lt;br&gt;problems with TIFF images with more than a single strip.
&lt;br&gt;&lt;br&gt;I am aware of libtiff's strip-based API, which is capable of writing
&lt;br&gt;strip data incrementally with TIFFWriteRawStrip. &amp;nbsp;Unfortunately, it
&lt;br&gt;expects already compressed data and is therefore not making use of the
&lt;br&gt;built-in compressors. &amp;nbsp;TIFFWriteEncodedStrip on the other hand
&lt;br&gt;compresses data prior to writing it, but it doesn't work incrementally,
&lt;br&gt;i.e. it expects the full data of each strip.
&lt;br&gt;&lt;br&gt;I assume that this is because libtiff's implementation of the
&lt;br&gt;compression algorithms cannot operate on streamed data? &amp;nbsp;I think it'd
&lt;br&gt;make sense to support this, as the data which needs to be buffered by
&lt;br&gt;most compression schemes should be substantially less (and never more)
&lt;br&gt;than the smallest strip size feasible for each algorithm.
&lt;br&gt;&lt;br&gt;What are you general thoughts on changing the compression
&lt;br&gt;implementations in this regard? &amp;nbsp;Do you think it is doable or am I
&lt;br&gt;overlooking something? &amp;nbsp;Is somebody already working on it or planning
&lt;br&gt;to?
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Lars
&lt;br&gt;&lt;br&gt;&lt;br&gt;P.S.: A bit of context: We ran into these issues with ghostscript, after
&lt;br&gt;porting all of its tiff output devices to use libtiff instead of writing
&lt;br&gt;output files manually (using ghostscript's streamable implementation of
&lt;br&gt;some of the compression schemes). &amp;nbsp;In order to provide backwards
&lt;br&gt;compatibility, the output files are written in a single strip.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26680132&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Full-strip-allocation-in-TIFFWriteScanline-tp26680132p26680132.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26679519</id>
	<title>Problems with multiple strip G4 to single strip G4 tiff.</title>
	<published>2009-12-07T08:06:24Z</published>
	<updated>2009-12-07T08:06:24Z</updated>
	<author>
		<name>Phillip Wiles</name>
	</author>
	<content type="html">  
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;If I use this below to write a tiff that started as single strip tiff, there is no problem. But when I try to write an image that started out &lt;br&gt;
as multiple strips it crashes. Do I &amp;quot;need&amp;quot; to save the image multiple strips? And if I do, can someone help in the right direction (I have experimented to try and force multiple strips with a group 4 image, with no luck). &lt;br&gt;
&lt;br&gt;TIFFSetField(out,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);&lt;br&gt;if(mbCompression){TIFFSetField(tif, TIFFTAG_COMPRESSION, mTiffCompression);}; &lt;br&gt;if(mbSubfileType){TIFFSetField(tif, TIFFTAG_SUBFILETYPE, muliSubfileType);}; &lt;/div&gt;

&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;if(mbResolutionUnit){TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, musiResolutionUnit);}; &lt;br&gt;if(mbXResolution){TIFFSetField(tif, TIFFTAG_XRESOLUTION, mfTiffXresolution);}; &lt;br&gt;
if(mbYResolution){TIFFSetField(tif, TIFFTAG_YRESOLUTION, mfTiffYresolution);}; &lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;if(mbImageWidth){TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, muliImageWidth);}; &lt;br&gt;if(mbImageLength){TIFFSetField(tif, TIFFTAG_IMAGELENGTH, muliImageHeight);}; &lt;/div&gt;

&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;if(mbPhotometricInterpretation){TIFFSetField(tif, TIFFTAG_PHOTOMETRIC ,musiPhotoMetric);}; &lt;br&gt;if(mbBitsPerSample){TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE ,musiBitPerSample);}; &lt;br&gt;
if(mbFillOrder){TIFFSetField(tif, TIFFTAG_FILLORDER, musiFillOrder);}; &lt;br&gt;if(mbSamplesPerPixel){TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, musiSamplePerPixel);}; &lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt; &lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;if(mbuf){TIFFWriteEncodedStrip(tif, 0, mbuf, (muliImageWidth * muliImageHeight) / 8);}; &lt;br&gt;&lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;//My attempt at creating multiple strip.&lt;br&gt;//if(mbRowsPerStrip){TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, muliRowsPerStrip);}; &lt;/div&gt;

&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;//tdata_t outbuf;&lt;br&gt;//char * p = (char*)mbuf;&lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt;//for(tstrip_t counter = 0; counter &amp;lt; mstrip; counter++){&lt;br&gt;//   outbuf = (void*)&amp;amp;p[counter * (muliImageWidth * muliRowsPerStrip)/8];&lt;br&gt;
//   TIFFWriteEncodedStrip(out, counter, outbuf, (muliImageWidth * muliRowsPerStrip)/8);&lt;br&gt;//};&lt;/div&gt;
&lt;div style=&quot;FONT-FAMILY: -moz-fixed; FONT-SIZE: 13px&quot; lang=&quot;x-western&quot; class=&quot;moz-text-flowed&quot;&gt; &lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26679519&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Problems-with-multiple-strip-G4-to-single-strip-G4-tiff.-tp26679519p26679519.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26666164</id>
	<title>Re: Adding tags to a broken(?) TIFF</title>
	<published>2009-12-06T07:57:50Z</published>
	<updated>2009-12-06T07:57:50Z</updated>
	<author>
		<name>Bob Friesenhahn</name>
	</author>
	<content type="html">On Sun, 6 Dec 2009, Juergen Buchmueller wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; FYI: I solved the problem by creating a new TIFF on the fly.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; It seems that libtiff doesn't handle extending a directory without
&lt;br&gt;&amp;gt; overwriting data at all. If a directory size increases, libtiff would
&lt;br&gt;&amp;gt; have to relocate the entire directory entry with all existing tags to
&lt;br&gt;&amp;gt; e.g. the end of the file. It doesn't do that now, but writes the new
&lt;br&gt;&amp;gt; tag to the file right after the end of the current directory, thereby
&lt;br&gt;&amp;gt; destroying whatever is there.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That's just my observation without looking into libtiff's source.
&lt;/div&gt;&lt;br&gt;What version of libtiff are you using?
&lt;br&gt;&lt;br&gt;Bob
&lt;br&gt;--
&lt;br&gt;Bob Friesenhahn
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26666164&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bfriesen@...&lt;/a&gt;, &lt;a href=&quot;http://www.simplesystems.org/users/bfriesen/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.simplesystems.org/users/bfriesen/&lt;/a&gt;&lt;br&gt;GraphicsMagick Maintainer, &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.GraphicsMagick.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.GraphicsMagick.org/&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26666164&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Adding-tags-to-a-broken%28-%29-TIFF-tp26573229p26666164.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26666172</id>
	<title>Re: TIFFFlushData1 return code verification</title>
	<published>2009-12-06T07:57:44Z</published>
	<updated>2009-12-06T07:57:44Z</updated>
	<author>
		<name>Evgeny Fraimovitch</name>
	</author>
	<content type="html">On 2009-12-06 17:56, Bob Friesenhahn wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sun, 6 Dec 2009, Evgeny Fraimovitch wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; There is a certain inconsistency in TIFFFlushData1 error code handling,
&lt;br&gt;&amp;gt;&amp;gt; which can lead to unreported disk write errors. (such as when we are out
&lt;br&gt;&amp;gt;&amp;gt; of disk space)
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; For possibly related thread please see: *1994.10.21 15:50 &amp;quot;Problems
&lt;br&gt;&amp;gt;&amp;gt; catching write errors in tiff library (v3.3beta021)&amp;quot;, by Ben Griffin*
&lt;br&gt;&amp;gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://www.asmail.be/msg0054980073.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.asmail.be/msg0054980073.html&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This email is from 1994. &amp;nbsp;What version of libtiff are you working with?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Bob
&lt;/div&gt;I know the date of this e-mail. (hence I cited the full date) However 
&lt;br&gt;the problematic code is found in libtiff 3.9.2. (The newest version)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; Evgeny
&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26666172&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/TIFFFlushData1-return-code-verification-tp26665328p26666172.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26666152</id>
	<title>Re: TIFFFlushData1 return code verification</title>
	<published>2009-12-06T07:56:29Z</published>
	<updated>2009-12-06T07:56:29Z</updated>
	<author>
		<name>Bob Friesenhahn</name>
	</author>
	<content type="html">On Sun, 6 Dec 2009, Evgeny Fraimovitch wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; There is a certain inconsistency in TIFFFlushData1 error code handling,
&lt;br&gt;&amp;gt; which can lead to unreported disk write errors. (such as when we are out
&lt;br&gt;&amp;gt; of disk space)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; For possibly related thread please see: *1994.10.21 15:50 &amp;quot;Problems
&lt;br&gt;&amp;gt; catching write errors in tiff library (v3.3beta021)&amp;quot;, by Ben Griffin*
&lt;br&gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://www.asmail.be/msg0054980073.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.asmail.be/msg0054980073.html&lt;/a&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;This email is from 1994. &amp;nbsp;What version of libtiff are you working 
&lt;br&gt;with?
&lt;br&gt;&lt;br&gt;Bob
&lt;br&gt;--
&lt;br&gt;Bob Friesenhahn
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26666152&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bfriesen@...&lt;/a&gt;, &lt;a href=&quot;http://www.simplesystems.org/users/bfriesen/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.simplesystems.org/users/bfriesen/&lt;/a&gt;&lt;br&gt;GraphicsMagick Maintainer, &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.GraphicsMagick.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.GraphicsMagick.org/&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26666152&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/TIFFFlushData1-return-code-verification-tp26665328p26666152.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26665756</id>
	<title>Re: Adding tags to a broken(?) TIFF</title>
	<published>2009-12-06T07:02:46Z</published>
	<updated>2009-12-06T07:02:46Z</updated>
	<author>
		<name>Juergen Buchmueller</name>
	</author>
	<content type="html">FYI: I solved the problem by creating a new TIFF on the fly.
&lt;br&gt;&lt;br&gt;It seems that libtiff doesn't handle extending a directory without
&lt;br&gt;overwriting data at all. If a directory size increases, libtiff would
&lt;br&gt;have to relocate the entire directory entry with all existing tags to
&lt;br&gt;e.g. the end of the file. It doesn't do that now, but writes the new
&lt;br&gt;tag to the file right after the end of the current directory, thereby
&lt;br&gt;destroying whatever is there.
&lt;br&gt;&lt;br&gt;That's just my observation without looking into libtiff's source.
&lt;br&gt;&lt;br&gt;Juergen
&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26665756&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Adding-tags-to-a-broken%28-%29-TIFF-tp26573229p26665756.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26665328</id>
	<title>TIFFFlushData1 return code verification</title>
	<published>2009-12-06T06:04:05Z</published>
	<updated>2009-12-06T06:04:05Z</updated>
	<author>
		<name>Evgeny Fraimovitch</name>
	</author>
	<content type="html">Good time of day,
&lt;br&gt;&lt;br&gt;There is a certain inconsistency in TIFFFlushData1 error code handling, 
&lt;br&gt;which can lead to unreported disk write errors. (such as when we are out 
&lt;br&gt;of disk space)
&lt;br&gt;&lt;br&gt;For possibly related thread please see: *1994.10.21 15:50 &amp;quot;Problems 
&lt;br&gt;catching write errors in tiff library (v3.3beta021)&amp;quot;, by Ben Griffin* 
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://www.asmail.be/msg0054980073.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.asmail.be/msg0054980073.html&lt;/a&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;In short: the tif_dumpmode.c DumpModeEncode returns (-1) when 
&lt;br&gt;TIFFFlushData1 fails
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (tif-&amp;gt;tif_rawcc &amp;gt;= tif-&amp;gt;tif_rawdatasize &amp;&amp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;!TIFFFlushData1(tif))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (-1);
&lt;br&gt;&lt;br&gt;however its users expect it to return zero or non-zero value.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;LogLuvEncode24 and siblings does the same mistake.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;as does PackBitsEncode
&lt;br&gt;&lt;br&gt;The fix is to replace 'return (-1)' to 'return 0' in such places.
&lt;br&gt;&lt;br&gt;Sincerely yours,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Evgeny
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;VisionMap Ltd
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tiff mailing list: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26665328&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tiff@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://lists.maptools.org/mailman/listinfo/tiff&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lists.maptools.org/mailman/listinfo/tiff&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.remotesensing.org/libtiff/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.remotesensing.org/libtiff/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/TIFFFlushData1-return-code-verification-tp26665328p26665328.html" />
</entry>

</feed>
