Bug report #12795

Georeferencer generates incorrect GDAL script when input file is JPG

Added by Casper Børgesen almost 9 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:C++ plugins/Georeferencer
Affected QGIS version:2.8.5 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:20891

Description

Problem:
When georeferencing a JPEG image QGIS return telling the transformation could not be made.

Why:
According to the GDAL script QGIS can generate, the process is split into two steps:
  1. gdal_translate
  2. gdalwarp

Script:

gdal_translate -of GTiff -gcp ... -gcp ... "original.jpg" "temp.jpg" 
gdalwarp -r near -tps -co COMPRESS=LZW -dstalpha "temp.jpg" "result.tif" 

The input and output argument provided to gdal_translate is both with JPG extension, while the -of argument is GTiff. gdalwarp cannot handle a GeoTIFF image with JPG extension.

Solution:
So either should the first process set the -of argument to JPEG (in this instance) or change the output extension to TIF.

History

#1 Updated by Nyall Dawson almost 9 years ago

  • Status changed from Open to Feedback

I can't reproduce - is this only when using the generated GDAL scripts? Does the georeferencing work OK from within QGIS itself?

#2 Updated by Casper Børgesen almost 9 years ago

Nyall Dawson wrote:

I can't reproduce - is this only when using the generated GDAL scripts? Does the georeferencing work OK from within QGIS itself?

I reported this problem because my users couldn't use QGIS directly and I had to create a batch script to solve the problem. Thats why I discovered the JPEG/TIFF problem.

I have a rather large (30MB) JPEG image and when I use QGIS to georeference it, I get the error "Failed to compute GCP transform. Transform is not solvable.". When I correct the JPEG/TIFF problem in the correspondig GDAL script generated by QGIS, the same transform succeeds. Thats why I thought the problem indeed was the extension.

I have just tried though with a small JPEG image and QGIS was able to transform it. I have tried both in QGIS f4c3f3d (latest weekly for windows).

Could this be image size related somehow?

#3 Updated by Nyall Dawson almost 9 years ago

So... to clarify, there's two issues. One is that the generated GDAL script is wrong, the second is that QGIS can't transform your file. Can you open a second issue for the failing to transform issue, and attach a link to the data and GCP points file?

#4 Updated by Nyall Dawson almost 9 years ago

  • Subject changed from Georeferencer sets wrong extension when inputting JPEG to Georeferencer generates incorrect GDAL script when input file is JPG

#5 Updated by Giovanni Manghi over 8 years ago

  • Operating System deleted (windows)
  • Affected QGIS version changed from 2.8.1 to 2.8.5
  • Status changed from Feedback to Open

#6 Updated by Giovanni Manghi almost 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF