Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx2.public.one.com ([10.246.18.22])
	by mail6.local.one.com (Dovecot) with LMTP id 1c/sEy9/4lgz9QEAsyOMew
	for <filtered@awaresystems.be>; Mon, 03 Apr 2017 17:51:45 +0000
X-HalOne-ID: 3244cf90-1896-11e7-a8fd-b82a72d88088
Received: from mail-oi0-f54.google.com (unknown [209.85.218.54])
	by mx2.public.one.com (Halon) with ESMTPS
	id 3244cf90-1896-11e7-a8fd-b82a72d88088;
	Mon, 03 Apr 2017 17:51:43 +0000 (UTC)
Received: by mail-oi0-f54.google.com with SMTP id b187so135193472oif.0
        for <filtered@awaresystems.be>; Mon, 03 Apr 2017 10:51:43 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-original-authentication-results:x-gm-message-state:delivered-to
         :date:from:to:in-reply-to:message-id:references:user-agent
         :mime-version:cc:subject:precedence:list-id:list-unsubscribe
         :list-archive:list-post:list-help:list-subscribe
         :content-transfer-encoding:sender:errors-to;
        bh=VmoAc+TVl0KEcLTulhgdGYzPu/+xclqn+xRbkdlRNuw=;
        b=ewo+RFYgWEczqIn/0CLzXtLftQsKa8nsHOgh5Gj1HSrx8+woA+u4UvCJlRCEr82lRA
         gBCyVpYDi6dxHToLo1CYMzQrRXKm9vCoq1rfJobnyQcm3EVGg3XW5snsuY28M9oinTuB
         oMPr/iVfU27wG2y7tKxGYvZHsdq1BJ1KChqxEp+m9if8etJ48FyeDudqFs93frDCvQLP
         uNvAZcG6rQlOwaSpSsNMm2ckvWEY5Ig6Lekcax+NPJyxbBf5EVnGU+aNoX3GPyVPXzPj
         gLX+MEdMSNp1ZGUlG3jmZ5SCwLB7nkb2fpTHbQimU3kMsYSxYm6qZG/hRR3Km8tWfvCB
         8vqg==
X-Original-Authentication-Results: mx.google.com;       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org
X-Gm-Message-State: AFeK/H22oHc7b8hT9e53ygO3GJ/gnmBVJt68JOYMPaOl99s8FaYG3jZM9qU9XZrRkT5r/FO+IySUTPKvGhnweuV5wyGZvdQ=
X-Received: by 10.202.207.19 with SMTP id f19mr9498738oig.115.1491241902228;
        Mon, 03 Apr 2017 10:51:42 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.202.188.65 with SMTP id m62csp183481oif;
        Mon, 3 Apr 2017 10:51:41 -0700 (PDT)
X-Received: by 10.223.136.246 with SMTP id g51mr15968202wrg.83.1491241900979;
        Mon, 03 Apr 2017 10:51:40 -0700 (PDT)
Return-Path: <tiff-bounces@lists.maptools.org>
Received: from lists.maptools.org (ks365428.kimsufi.com. [94.23.4.142])
        by mx.google.com with ESMTP id o5si16189864wma.65.2017.04.03.10.51.40;
        Mon, 03 Apr 2017 10:51:40 -0700 (PDT)
Received-SPF: neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=94.23.4.142;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 2DDF935C02C;
	Mon,  3 Apr 2017 12:50:51 -0500 (EST)
Received: from smtp.simplesystems.org (smtp.simplesystems.org [65.66.246.90])
	by lists.maptools.org (Postfix) with ESMTPS id 03B0335C02A
	for <tiff@lists.maptools.org>; Mon,  3 Apr 2017 12:50:39 -0500 (EST)
Received: from scrappy.simplesystems.org (scrappy.simplesystems.org
	[65.66.246.73])
	by smtp.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id
	v33HobPA028762; Mon, 3 Apr 2017 12:50:37 -0500 (CDT)
Date: Mon, 3 Apr 2017 12:50:37 -0500 (CDT)
From: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
X-X-Sender: bfriesen@scrappy.simplesystems.org
To: Dinesh Iyer <dsi.maillist@gmail.com>
In-Reply-To: <CAHcSuBrMiYmF=OW9T-UyAYcLdYudzYP-pRuCXSy_8VcAfGReQw@mail.gmail.com>
Message-ID: <alpine.GSO.2.20.1704031245250.13187@scrappy.simplesystems.org>
References: <CAHcSuBrMiYmF=OW9T-UyAYcLdYudzYP-pRuCXSy_8VcAfGReQw@mail.gmail.com>
User-Agent: Alpine 2.20 (GSO 67 2015-01-07)
MIME-Version: 1.0
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
	(smtp.simplesystems.org [65.66.246.90]);
	Mon, 03 Apr 2017 12:50:37 -0500 (CDT)
Cc: TIFF mailing list <tiff@lists.maptools.org>
Subject: Re: [Tiff] Reading images with bits per pixel not a multiple of 8
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

On Mon, 3 Apr 2017, Dinesh Iyer wrote:
>
> My understanding is that after calling TIFFReadEncodedStrip/Tile the data I
> get back is packed i.e. one sample might have all its bits stored across a
> byte-boundary. Is this true for all cases or does this apply only for
> PackBits compression?

It applies for all cases.

Except for depths 8, 16, and 24 (which are swapped to "native" 
endianness by libtiff), the data is always ordered in 
most-significant-bit order 
so you need to start with the top bits.

I put sample files (with interesting strange depths) written by 
GraphicsMagick out for ftp under 
ftp://ftp.simplesystems.org/pub/tiff-samples/

In particular

ftp://ftp.simplesystems.org/pub/tiff-samples/tiff-sample-images-be.tar.gz

and

ftp://ftp.simplesystems.org/pub/tiff-samples/tiff-sample-images-le.tar.gz

There are also BigTIFF versions there.

Bob
-- 
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
