Opened 16 years ago
Closed 16 years ago
#2476 closed defect (worksforme)
CreateCopy() on JPEG driver always fails
Reported by: | kabiraman | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | 1.5.1 |
Severity: | normal | Keywords: | jpeg |
Cc: |
Description
I am trying to create a JPEG of a raster dataset, however CreateCopy() fails (get back an empty pointer) on all raster datasets I've tried. Here's the code:
bool GDALFileConverterProcess::writeToFile(GDALDataset* pDS) { const char* pFormat = "JPEG"; GDALDriver* pDriver; char** ppMetadata; pDriver = GetGDALDriverManager()->GetDriverByName(pFormat); if(pDriver == NULL) { return false; } ppMetadata = pDriver->GetMetadata(); if(!CSLFetchBoolean( ppMetadata, GDAL_DCAP_CREATECOPY, FALSE)) { return false; } GDALDatasetH pConvertedDataset = 0; pConvertedDataset = pDriver->CreateCopy(m_strSavePath.c_str(), pDS, FALSE, NULL, NULL, NULL); if (pConvertedDataset == 0) { return false; } GDALClose(pConvertedDataset); return true; }
Change History (3)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Component: | default → GDAL_Raster |
---|---|
Keywords: | jpeg added |
comment:3 by , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Closing due to lack of feedback from reporter.
Note:
See TracTickets
for help on using tickets.
The presented code is not sufficent to diagnose the problem.
Is an error issued with CPLError() during the create copy operation? If stderr is lost in your setup, you can still call CPLGetLastErrorMsg() after the CreateCopy() call.
Generally speaking an explanatory error should be issued if the createcopy fails. The JPEG format only supports a fairly limited number of configurations (8bit*1band and 8bit*3bands) so that might be the issue, but you provide no information on the input image configurations.