enricofer / django-warp

a reusable django app for raster maps georeferencing
GNU General Public License v3.0
16 stars 1 forks source link

Error : band 1 has no color table - Cannot georeference B&W images? #8

Open soniok opened 6 years ago

soniok commented 6 years ago

For those interrested in what images I'm using, they are non-georeferenced, .jp2(Jpeg2000) format, B&W historical orthophotos available from the French Geographic Institute. Available for free and are public domain. IGN - Remonte Le Temps Then I convert them to .PNG before uploading them to the site.


I get an error when I try to georeference a black and white image. My goal is to georeference mostly black and white, and a few colored images.

So here is my error:

Error : band 1 has no color table

Here is my temp fix, can we make it better? Edit line 662:

  #expand = '-expand rgb'     <-- comment this line
  expand = ''                 <-- add this line underneath ^^

With the edit above, everything works fine. Can @enricofer mod this correction to properly work for grayscale/B&W and color images?

enricofer commented 6 years ago

The only source image formats supported by the application are jpg and png. That's because the image is loaded in openlayers for registration points coupling that handles any web image format. The line you suggest to modify is needed to reclassify any source image type to a common rgb type. The scenario app use does not include multiband images because I think there are other powerful system to handle them. The typical source is an old scanner map in png or jpeg of b&w, grayscale or rgb type, so a png B&W should be processed without problem, but no tiffs or jp2 at all. But It would interesting explore other possible workflows.