I submitted a fix to PDL CVS yesterday that appears to work for
16-bit PNM and PNG file types.  That should be available in the
next PDL release.  Thanks again for the report.

In the meantime, you could either build from the CVS sources if
you are comfortable with that.  Otherwise, you could hand roll a
16-bit grayscale PNM image that could be converted by another
utility like pnmtotiff or arcmap...

Here is the sequence from the perldl shell:

use PDL;
use PDL::NiceSlice;
use PDL::IO::Pic;
use PDL::IO::FlexRaw;

$a = sequence(256,255)->ushort;

$fh = new IO::File "> test.pnm";

print $fh "P5\n";
print $fh join(' ', $a->dims) . "\n";
print $fh "65535\n";

$hdr = writeflex($fh, $a(:,-1:0));

$fh->close;

system('pnmtotiff test.pnm >test.tif');

Hope this helps.  --Chris

János Gonzales wrote:
Just to close up this topic, I wasn't able to create 16-bit Tiffs from
PDL but I was able to print out the piddle into an ASCII file, and
then used another program (Arcmap)  to transform that to a 16-bit
raster.



On Dec 12, 2007 2:38 PM, Christian Soeller <[EMAIL PROTECTED]> wrote:
24 bit RGB is really 3 separate 8-bit channels which does not help you.
Whenever I need to preserve data with higher bit depth I use the netcdf
interface (PDL::NetCDF) which is a CPAN module.
Christian



On 13/12/2007, at 8:41 AM, János Gonzales wrote:

Hi Christian,

Thanks so much for your response.  Maybe I'm missing something here,
but I don't understand how all the Pic code is in 8 bit, since on the
PDL homepage they have an example where they transform a JPEG image of
a space shuttle which is a 24 bit image.  They use 'wim' to export and
I thought that was a Pic subroutine.  I don't necessarily have to
output a TIFF, just any image format that will hold all of my values
above 255.  Do I have another option?

Janos




On Dec 12, 2007 12:14 PM, Christian Soeller <[EMAIL PROTECTED]>
wrote:
Hi Janos,

The currently included Tiff IO code (and all other Pic code) is 8 bit only.
A better interface would use libtiff for I/O but that is non-trivial due to
the variety of TIFFs one encounters in the field.

I once made a very simplistic 16bit TiFF reader for PDL. Somebody
sufficiently knowledgeable could write a 16bit writer I suppose.

Christian





On 13/12/2007, at 6:34 AM, János Gonzales wrote:

Hello,
This is probably really easy, but I'm a newbie so I'm not sure how to
do it.   I'm trying to output a 16-bit Tiff, but all I get is an 8 bit
tiff.
Here's my pseudo code:


use PDL;
use PDL::NiceSlice;
use PDL::IO::Pic;

$blank_slate = zeroes(1800,900);

.......in here i add values to the blank_slate piddle from 0 to about 3000

$blank_slate->wpic("test.tif");


So, if I look at test.tiff  it's 1800x900 pixels, but the max value is
255 and not 3000.  If it was a 16-bit tiff it could accomodate this
value.  I'm running this on Windows XP, and I have the netpbm binaries
installed. (I noticed my wpic command calls pnmtotiff )

Any ideas?

Thanks much,
Janos

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

--
Christian Soeller PhD   Dept. of Physiology  +64 9 3737599 x82770
University of Auckland  Auckland, New Zealand  fax +64 9 3737499





--
Christian Soeller PhD   Dept. of Physiology  +64 9 3737599 x82770
University of Auckland  Auckland, New Zealand  fax +64 9 3737499



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl




_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to