gdal jpeg creation problem
Frank Warmerdam
warmerdam at p...
Thu Nov 16 10:12:22 EST 2000
gschmidt at d... wrote:
>
> Hi,
>
> I encountered a problem when writing many (>100) jpeg files. I use
> the CopyCreate(..) with a memory image as source. Since I access the
> gdal out of java (via j/direct), I am not able to debug the c-part.
>
> The error message I get after calling the CopyCreate() is:
> ERROR 200: Didn't parse through to #GRID successfully in.
>
> All flushing commands do not help.
>
> Do you have any hints?
Günter,
The error message is coming from the GXF Grid reader. After the
JPGDataset::CreateCopy() method creates the output jpeg file (which
is presumably working), it calls GDALOpen() to reopen the file for read
access.
GDALOpen() calls all the drivers in order, but unfortunately the GXF
driver occationally recognises a file improperly as GXF and tries to read
it. If later, it finds the file is missing important information (ie.
the #GRID directive) it produces an error which terminates open as GXF
_and also stops GDALOpen() to going on to the next driver_! This is
intentional, so that error messages about corrupt files can be reported
to the user.
The real problem then is that the GXF drivers "test" for GXFishness is
weak, and one of the particular jpeg files you wrote was mistakenly
recognised as GXF. In fact I have run into this once or twice myself
but I didn't really understand what had gone wrong.
I have taken the following steps to correct the problem:
o I have moved GXF near the bottom of the driver list in GDALAllRegister()
so it won't generally be called till all other drivers have been tried.
o I have modified gxfdataset.cpp::Open() so that a "zero" character anywhere
in the header is recognised as invalidating the file as being GXF. This
will likely eliminate any problems for JPEG.
Are you working with the current source of GDAL from CVS, or a copy from
last year? If you are working with an old copy, and are not eager to upgrade
to the current code I would suggest just removing the GDALRegister_GXF()
call from GDALAllRegister() for now.
> Thanks a lot (and greetings from Arno Schäpe, eCognition Group)
My best regards to everyone. I tried the focuServer, and it looks cool.
Are you interested in support for generating progressive JPEGs for this?
I could see this being a useful improvement, though it seems fast and smooth
enough to me now.
PS. I have taken the liberty of cc:ing this message to the GDAL mailing list.
I hope you don't mind, but others might run into related problems.
Best regards,
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at p...
light and sound - activate the windows | http://pobox.com/~warmerda
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list