| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2009.12.09 08:11 "Re: Problems with multiple strip G4 to single strip G4 tiff.", by Juergen BuchmuellerOn Wed, 9 Dec 2009 02:47:52 -0500
Phillip Wiles <pwiles38@gmail.com> wrote:
> I am 99.9% certain that it is my code that is causing the crash. I should
> have been clearer on that.
Ok, I thought you had checked that :)
> I downloaded GDB and it looks interesting, but it's likely overkill for this
> problem and likely over my head.
Nah, it's dead simple. Let your program write a coredump (perhaps
setting "ulimit -c unlimited" before), then run "gdb
path/to/your/program xyz.core" and do a "bt" for backtrace. If you
compiled your code with symbols (-g option of gcc) you'll see on which
line it was.
> I'm not asking that anyone do the work for me. I'm looking for direction (or
> explanation as to what I'm doing wrong) to the correct way to save the image
> a single strip, when the original image was multiple strip.
I thought you wanted to do it the other way round? Anyway, here's a
code snippet from my libtiff usage, omitting the setting of all the
other necessary tags:
/* write a striped image */
rowsperstrip = TIFFDefaultStripSize(hTIFF, fmt->image_length);
if (rowsperstrip > fmt->image_length) {
rowsperstrip = fmt->image_length;
LOG(LINFO,(_fun,"clamping to image length: %u\n",
rowsperstrip));
}
rc = TIFFSetField(hTIFF, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
for (y = 0; y < fmt->image_length; y++) {
tdata_t row = (tdata_t)(tiff->mem.data + y * tiff->stride + x);
rc = TIFFWriteScanline(hTIFF, row, y, 0);
if (rc != 1) {
LOG(LERROR,(_fun,"TIFFWriteScanline(%p,%p,%d,%d) "
"failed (%d)\n", tiff, row, y, 0, rc));
goto abort;
}
}
...
HTH,
Juergen
|
|||||||