[gdal-dev] Troubleshooting palette management. Potential bug in palette for overviews?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3
Hi List,
I'm investigating on a issue I have with a paletted image with overviews, using java ImageIO tiff reader (wait... I know on this list we discuss about GDAL topics :) ).
I'm trying to better understand palette interpretation and palette storing on tags and how they are handled by GDAL. 

From TIFF specifications, colormap entries are stored as short values.
I have a sample file with this color tab (as reported by gdalinfo).

Color Table (RGB with 256 entries)
  0: 164,164,164,255
  1: 255,255,255,255
  2: 0,0,0,255
  3: 0,0,0,255
.... repeat 0,0,0,255 to the end.

Using an Hex editor or AsTiffTagViewer, I can see the byte values of the colormap as stored on the file.
For the first 4 mappings of the colortable the Red components are: 
A4 A4 FF FF 00 00 00 00
(8 bytes = 4 shorts)

As far as I have understood, this is related to that part of the specification (quoting it, section 5):

In a TIFF ColorMap, all the Red values come first, followed by the Green values, then the Blue values. In the ColorMap, black is represented by 0,0,0 and white is represented by 65535, 65535, 65535

So the second entry of the map, being white (255, 255, 255) has its red value stored as 65535 = FF FF whilst the first color (164,164,164) has its red value stored as 42148 = A4 A4

I see this behavior is confirmed by the way the geotiff.cpp create the colortable:

panTRed[iColor] = static_cast<unsigned short>(257 * sRGB.c1);
panTGreen[iColor] = static_cast<unsigned short>(257 * sRGB.c2);
panTBlue[iColor] = static_cast<unsigned short>(257 * sRGB.c3)

Applying a color*257 multiplication allows to have its 8 bits color representation stored into a short where intensity goes from 0 to 65535.

The issue I have is that when using gdaladdo, the overviews are generated with a different color table.
So that the first 8 bytes of the red component stored in the colormap,as reported by AsTiffTagViewer are:
A4 00 FF 00 00 00 00 00

When converting it back to a 0-255 color component with the formula R*255/65535 it become 163 instead of 164.

I see in the GDAL code that both the IBuildOverviews and CreateOverviewsFromSrcOverviews call the CreateTIFFColorTable function which multiplies the colorMapEntry by 256 instead of 257.


This may explain the A4 00 FF 00 entries in the overview with respect to the A4 A4 FF FF entries in the main level.

Do you have any feedback on this? 
Please, let me know what do you think about it.

Best Regards,
Daniele










--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: <a href="tel:%2B39%200584%20962313" value="+390584962313" target="_blank">+39 0584 962313
fax:      <a href="tel:%2B39%200584%201660272" value="+3905841660272" target="_blank">+39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.



_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Even Rouault-2

Daniele,

 

This is indeed an inconsistency I spotted a long time ago :

https://trac.osgeo.org/gdal/ticket/2213

 

Nobody was apparently sufficiently annoyed by this to fix it. Actually I see I proposed a patch. Was probably waiting for feedback. I'm not sure if there's a standardized way of converting between the [0,255] and [0,65535] ranges.

 

Even

 

> Hi List,

> I'm investigating on a issue I have with a paletted image with overviews,

> using java ImageIO tiff reader (wait... I know on this list we discuss

> about GDAL topics :) ).

> I'm trying to better understand palette interpretation and palette storing

> on tags and how they are handled by GDAL.

>

> From TIFF specifications, colormap entries are stored as short values.

> I have a sample file with this color tab (as reported by gdalinfo).

>

> Color Table (RGB with 256 entries)

> 0: *164*,164,164,255

> 1: *255*,255,255,255

> 2: 0,0,0,255

> 3: 0,0,0,255

> .... repeat 0,0,0,255 to the end.

>

> Using an Hex editor or AsTiffTagViewer, I can see the byte values of the

> colormap as stored on the file.

> For the first 4 mappings of the colortable the Red components are:

> *A4 A4* *FF FF* 00 00 00 00

> (8 bytes = 4 shorts)

>

> As far as I have understood, this is related to that part of the

> specification (quoting it, section 5):

>

>

> *In a TIFF ColorMap, all the Red values come first, followed by the Green

> values, then the Blue values. In the ColorMap, black is represented by

> 0,0,0 and white is represented by 65535, 65535, 65535*

>

> So the second entry of the map, being white (255, 255, 255) has its red

> value stored as 65535 = *FF FF *whilst the first color (164,164,164) has

> its red value stored as 42148 = *A4 A4*

>

> I see this behavior is confirmed by the way the geotiff.cpp create the

> colortable:

> https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/geotiff.cpp#L5043

>

> panTRed[iColor] = static_cast<unsigned short>(257 * sRGB.c1);

> panTGreen[iColor] = static_cast<unsigned short>(257 * sRGB.c2);

> panTBlue[iColor] = static_cast<unsigned short>(257 * sRGB.c3)

>

> Applying a color*257 multiplication allows to have its 8 bits color

> representation stored into a short where intensity goes from 0 to 65535.

>

> The issue I have is that when using gdaladdo, the overviews are generated

> with a different color table.

> So that the first 8 bytes of the red component stored in the colormap,as

> reported by AsTiffTagViewer are:

> *A4* 00 *FF* 00 00 00 00 00

>

> When converting it back to a 0-255 color component with the formula

> R*255/65535 it become *163* instead of 164.

>

> I see in the GDAL code that both the IBuildOverviews and

> CreateOverviewsFromSrcOverviews call the CreateTIFFColorTable function

> which multiplies the colorMapEntry by 256 instead of 257.

>

> https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/geotiff.cpp#L9137

>

> This may explain the *A4* 00 *FF* 00 entries in the overview with respect

> to the *A4 A4 FF FF *entries in the main level.

>

> Do you have any feedback on this?

> Please, let me know what do you think about it.

>

> Best Regards,

> Daniele

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3
Doh!
Thanks for the feedback, Even. (Indeed it seemed strange to me that nobody had ever noticed before)

Best Regards,
Daniele

On Thu, Nov 24, 2016 at 1:35 PM, Even Rouault <[hidden email]> wrote:

Daniele,

 

This is indeed an inconsistency I spotted a long time ago :

https://trac.osgeo.org/gdal/ticket/2213

 

Nobody was apparently sufficiently annoyed by this to fix it. Actually I see I proposed a patch. Was probably waiting for feedback. I'm not sure if there's a standardized way of converting between the [0,255] and [0,65535] ranges.

 

Even

 

> Hi List,

> I'm investigating on a issue I have with a paletted image with overviews,

> using java ImageIO tiff reader (wait... I know on this list we discuss

> about GDAL topics :) ).

> I'm trying to better understand palette interpretation and palette storing

> on tags and how they are handled by GDAL.

>

> From TIFF specifications, colormap entries are stored as short values.

> I have a sample file with this color tab (as reported by gdalinfo).

>

> Color Table (RGB with 256 entries)

> 0: *164*,164,164,255

> 1: *255*,255,255,255

> 2: 0,0,0,255

> 3: 0,0,0,255

> .... repeat 0,0,0,255 to the end.

>

> Using an Hex editor or AsTiffTagViewer, I can see the byte values of the

> colormap as stored on the file.

> For the first 4 mappings of the colortable the Red components are:

> *A4 A4* *FF FF* 00 00 00 00

> (8 bytes = 4 shorts)

>

> As far as I have understood, this is related to that part of the

> specification (quoting it, section 5):

>

>

> *In a TIFF ColorMap, all the Red values come first, followed by the Green

> values, then the Blue values. In the ColorMap, black is represented by

> 0,0,0 and white is represented by 65535, 65535, 65535*

>

> So the second entry of the map, being white (255, 255, 255) has its red

> value stored as 65535 = *FF FF *whilst the first color (164,164,164) has

> its red value stored as 42148 = *A4 A4*

>

> I see this behavior is confirmed by the way the geotiff.cpp create the

> colortable:

> https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/geotiff.cpp#L5043

>

> panTRed[iColor] = static_cast<unsigned short>(257 * sRGB.c1);

> panTGreen[iColor] = static_cast<unsigned short>(257 * sRGB.c2);

> panTBlue[iColor] = static_cast<unsigned short>(257 * sRGB.c3)

>

> Applying a color*257 multiplication allows to have its 8 bits color

> representation stored into a short where intensity goes from 0 to 65535.

>

> The issue I have is that when using gdaladdo, the overviews are generated

> with a different color table.

> So that the first 8 bytes of the red component stored in the colormap,as

> reported by AsTiffTagViewer are:

> *A4* 00 *FF* 00 00 00 00 00

>

> When converting it back to a 0-255 color component with the formula

> R*255/65535 it become *163* instead of 164.

>

> I see in the GDAL code that both the IBuildOverviews and

> CreateOverviewsFromSrcOverviews call the CreateTIFFColorTable function

> which multiplies the colorMapEntry by 256 instead of 257.

>

> https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/geotiff.cpp#L9137

>

> This may explain the *A4* 00 *FF* 00 entries in the overview with respect

> to the *A4 A4 FF FF *entries in the main level.

>

> Do you have any feedback on this?

> Please, let me know what do you think about it.

>

> Best Regards,

> Daniele

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.



_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Even Rouault-2

On jeudi 24 novembre 2016 16:51:59 CET Daniele Romagnoli wrote:

> Doh!

> Thanks for the feedback, Even. (Indeed it seemed strange to me that nobody

> had ever noticed before)

 

Not that much regarding software using GDAL since if you don't explicitly request the overview bands/datasets but rather use the subsampling RasterIO() calls, you'll never work directly with the color table of the overviews but still use the one of the main dataset (or even if you request the overviews directly I guess in most cases applications don't bother checking if the color table of the overview). In GDAL, overviews conceptually share the same palette than the main image. Otherwise subsampling RasterIO() will return values of the overview palette that will be interpreted with the palette of the main image. You can imagine the fun visual effects if the palette are not the same... So this is assumed, but not checked.

 

Could be worth fixing that if that cause issues (apparently in your use case at least), but I'd be interested by information of what is the standard/recommanded/best-practice-in-the-industry/etc... formulas to use for the mapping between the [0,255] and [0,65535] ranges.

 

>

> Best Regards,

> Daniele

>

> On Thu, Nov 24, 2016 at 1:35 PM, Even Rouault <[hidden email]>

>

> wrote:

> > Daniele,

> >

> >

> >

> > This is indeed an inconsistency I spotted a long time ago :

> >

> > https://trac.osgeo.org/gdal/ticket/2213

> >

> >

> >

> > Nobody was apparently sufficiently annoyed by this to fix it. Actually I

> > see I proposed a patch. Was probably waiting for feedback. I'm not sure if

> > there's a standardized way of converting between the [0,255] and [0,65535]

> > ranges.

> >

> >

> >

> > Even

> >

> > > Hi List,

> > >

> > > I'm investigating on a issue I have with a paletted image with

> > > overviews,

> > >

> > > using java ImageIO tiff reader (wait... I know on this list we discuss

> > >

> > > about GDAL topics :) ).

> > >

> > > I'm trying to better understand palette interpretation and palette

> >

> > storing

> >

> > > on tags and how they are handled by GDAL.

> > >

> > >

> > >

> > > From TIFF specifications, colormap entries are stored as short values.

> > >

> > > I have a sample file with this color tab (as reported by gdalinfo).

> > >

> > >

> > >

> > > Color Table (RGB with 256 entries)

> > >

> > > 0: *164*,164,164,255

> > >

> > > 1: *255*,255,255,255

> > >

> > > 2: 0,0,0,255

> > >

> > > 3: 0,0,0,255

> > >

> > > .... repeat 0,0,0,255 to the end.

> > >

> > >

> > >

> > > Using an Hex editor or AsTiffTagViewer, I can see the byte values of the

> > >

> > > colormap as stored on the file.

> > >

> > > For the first 4 mappings of the colortable the Red components are:

> > >

> > > *A4 A4* *FF FF* 00 00 00 00

> > >

> > > (8 bytes = 4 shorts)

> > >

> > >

> > >

> > > As far as I have understood, this is related to that part of the

> > >

> > > specification (quoting it, section 5):

> > >

> > >

> > >

> > >

> > >

> > > *In a TIFF ColorMap, all the Red values come first, followed by the

> > > Green

> > >

> > > values, then the Blue values. In the ColorMap, black is represented by

> > >

> > > 0,0,0 and white is represented by 65535, 65535, 65535*

> > >

> > >

> > >

> > > So the second entry of the map, being white (255, 255, 255) has its red

> > >

> > > value stored as 65535 = *FF FF *whilst the first color (164,164,164) has

> > >

> > > its red value stored as 42148 = *A4 A4*

> > >

> > >

> > >

> > > I see this behavior is confirmed by the way the geotiff.cpp create the

> > >

> > > colortable:

> > >

> > > https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/

> >

> > geotiff.cpp#L5043

> >

> > > panTRed[iColor] = static_cast<unsigned short>(257 * sRGB.c1);

> > >

> > > panTGreen[iColor] = static_cast<unsigned short>(257 * sRGB.c2);

> > >

> > > panTBlue[iColor] = static_cast<unsigned short>(257 * sRGB.c3)

> > >

> > >

> > >

> > > Applying a color*257 multiplication allows to have its 8 bits color

> > >

> > > representation stored into a short where intensity goes from 0 to 65535.

> > >

> > >

> > >

> > > The issue I have is that when using gdaladdo, the overviews are

> > > generated

> > >

> > > with a different color table.

> > >

> > > So that the first 8 bytes of the red component stored in the colormap,as

> > >

> > > reported by AsTiffTagViewer are:

> > >

> > > *A4* 00 *FF* 00 00 00 00 00

> > >

> > >

> > >

> > > When converting it back to a 0-255 color component with the formula

> > >

> > > R*255/65535 it become *163* instead of 164.

> > >

> > >

> > >

> > > I see in the GDAL code that both the IBuildOverviews and

> > >

> > > CreateOverviewsFromSrcOverviews call the CreateTIFFColorTable function

> > >

> > > which multiplies the colorMapEntry by 256 instead of 257.

> > >

> > >

> > >

> > > https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/

> >

> > geotiff.cpp#L9137

> >

> > > This may explain the *A4* 00 *FF* 00 entries in the overview with

> > > respect

> > >

> > > to the *A4 A4 FF FF *entries in the main level.

> > >

> > >

> > >

> > > Do you have any feedback on this?

> > >

> > > Please, let me know what do you think about it.

> > >

> > >

> > >

> > > Best Regards,

> > >

> > > Daniele

> >

> > --

> >

> > Spatialys - Geospatial professional services

> >

> > http://www.spatialys.com

> >

> > _______________________________________________

> > gdal-dev mailing list

> > [hidden email]

> > http://lists.osgeo.org/mailman/listinfo/gdal-dev

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3


On Thu, Nov 24, 2016 at 5:01 PM, Even Rouault <[hidden email]> wrote:

On jeudi 24 novembre 2016 16:51:59 CET Daniele Romagnoli wrote:

> Doh!

> Thanks for the feedback, Even.

 

(Indeed it seemed strange to me that nobody had ever noticed before)

Sorry, what I meant with that was that I didn't see that ticket before sending my email so it seemed strange to me that nobody noticed the palette math weirdness :)
 

 

Not that much regarding software using GDAL since if you don't explicitly request the overview bands/datasets but rather use the subsampling RasterIO() calls, you'll never work directly with the color table of the overviews but still use the one of the main dataset (or even if you request the overviews directly I guess in most cases applications don't bother checking if the color table of the overview).


As far as I can see, the TIFFImageReader parses the metadata information based on imageIndex (so overview number). I will double check if things were working differently in the colormap topic before our changes/optimizations to this class.
 

In GDAL, overviews conceptually share the same palette than the main image. Otherwise subsampling RasterIO() will return values of the overview palette that will be interpreted with the palette of the main image. You can imagine the fun visual effects if the palette are not the same... So this is assumed, but not checked.

 

Could be worth fixing that if that cause issues (apparently in your use case at least), but I'd be interested by information of what is the standard/recommanded/best-practice-in-the-industry/etc... formulas to use for the mapping between the [0,255] and [0,65535] ranges.

 


Cheers,
Daniele 

>

> Best Regards,

> Daniele

>

> On Thu, Nov 24, 2016 at 1:35 PM, Even Rouault <[hidden email]>

>

> wrote:

> > Daniele,

> >

> >

> >

> > This is indeed an inconsistency I spotted a long time ago :

> >

> > https://trac.osgeo.org/gdal/ticket/2213

> >

> >

> >

> > Nobody was apparently sufficiently annoyed by this to fix it. Actually I

> > see I proposed a patch. Was probably waiting for feedback. I'm not sure if

> > there's a standardized way of converting between the [0,255] and [0,65535]

> > ranges.

> >

> >

> >

> > Even

> >

> > > Hi List,

> > >

> > > I'm investigating on a issue I have with a paletted image with

> > > overviews,

> > >

> > > using java ImageIO tiff reader (wait... I know on this list we discuss

> > >

> > > about GDAL topics :) ).

> > >

> > > I'm trying to better understand palette interpretation and palette

> >

> > storing

> >

> > > on tags and how they are handled by GDAL.

> > >

> > >

> > >

> > > From TIFF specifications, colormap entries are stored as short values.

> > >

> > > I have a sample file with this color tab (as reported by gdalinfo).

> > >

> > >

> > >

> > > Color Table (RGB with 256 entries)

> > >

> > > 0: *164*,164,164,255

> > >

> > > 1: *255*,255,255,255

> > >

> > > 2: 0,0,0,255

> > >

> > > 3: 0,0,0,255

> > >

> > > .... repeat 0,0,0,255 to the end.

> > >

> > >

> > >

> > > Using an Hex editor or AsTiffTagViewer, I can see the byte values of the

> > >

> > > colormap as stored on the file.

> > >

> > > For the first 4 mappings of the colortable the Red components are:

> > >

> > > *A4 A4* *FF FF* 00 00 00 00

> > >

> > > (8 bytes = 4 shorts)

> > >

> > >

> > >

> > > As far as I have understood, this is related to that part of the

> > >

> > > specification (quoting it, section 5):

> > >

> > >

> > >

> > >

> > >

> > > *In a TIFF ColorMap, all the Red values come first, followed by the

> > > Green

> > >

> > > values, then the Blue values. In the ColorMap, black is represented by

> > >

> > > 0,0,0 and white is represented by 65535, 65535, 65535*

> > >

> > >

> > >

> > > So the second entry of the map, being white (255, 255, 255) has its red

> > >

> > > value stored as 65535 = *FF FF *whilst the first color (164,164,164) has

> > >

> > > its red value stored as 42148 = *A4 A4*

> > >

> > >

> > >

> > > I see this behavior is confirmed by the way the geotiff.cpp create the

> > >

> > > colortable:

> > >

> > > https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/

> >

> > geotiff.cpp#L5043

> >

> > > panTRed[iColor] = static_cast<unsigned short>(257 * sRGB.c1);

> > >

> > > panTGreen[iColor] = static_cast<unsigned short>(257 * sRGB.c2);

> > >

> > > panTBlue[iColor] = static_cast<unsigned short>(257 * sRGB.c3)

> > >

> > >

> > >

> > > Applying a color*257 multiplication allows to have its 8 bits color

> > >

> > > representation stored into a short where intensity goes from 0 to 65535.

> > >

> > >

> > >

> > > The issue I have is that when using gdaladdo, the overviews are

> > > generated

> > >

> > > with a different color table.

> > >

> > > So that the first 8 bytes of the red component stored in the colormap,as

> > >

> > > reported by AsTiffTagViewer are:

> > >

> > > *A4* 00 *FF* 00 00 00 00 00

> > >

> > >

> > >

> > > When converting it back to a 0-255 color component with the formula

> > >

> > > R*255/65535 it become *163* instead of 164.

> > >

> > >

> > >

> > > I see in the GDAL code that both the IBuildOverviews and

> > >

> > > CreateOverviewsFromSrcOverviews call the CreateTIFFColorTable function

> > >

> > > which multiplies the colorMapEntry by 256 instead of 257.

> > >

> > >

> > >

> > > https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/

> >

> > geotiff.cpp#L9137

> >

> > > This may explain the *A4* 00 *FF* 00 entries in the overview with

> > > respect

> > >

> > > to the *A4 A4 FF FF *entries in the main level.

> > >

> > >

> > >

> > > Do you have any feedback on this?

> > >

> > > Please, let me know what do you think about it.

> > >

> > >

> > >

> > > Best Regards,

> > >

> > > Daniele

> >

> > --

> >

> > Spatialys - Geospatial professional services

> >

> > http://www.spatialys.com

> >

> > _______________________________________________

> > gdal-dev mailing list

> > [hidden email]

> > http://lists.osgeo.org/mailman/listinfo/gdal-dev

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.



_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3
For future references (...mainly for me), I'm updating the previous links using a tagged version.
Otherwise, the line numbers referring a trunk repository will point to some comment or unrelated things :) 


Daniele


On Thu, Nov 24, 2016 at 5:22 PM, Daniele Romagnoli <[hidden email]> wrote:


On Thu, Nov 24, 2016 at 5:01 PM, Even Rouault <[hidden email]> wrote:

On jeudi 24 novembre 2016 16:51:59 CET Daniele Romagnoli wrote:

> Doh!

> Thanks for the feedback, Even.

 

(Indeed it seemed strange to me that nobody had ever noticed before)

Sorry, what I meant with that was that I didn't see that ticket before sending my email so it seemed strange to me that nobody noticed the palette math weirdness :)
 

 

Not that much regarding software using GDAL since if you don't explicitly request the overview bands/datasets but rather use the subsampling RasterIO() calls, you'll never work directly with the color table of the overviews but still use the one of the main dataset (or even if you request the overviews directly I guess in most cases applications don't bother checking if the color table of the overview).


As far as I can see, the TIFFImageReader parses the metadata information based on imageIndex (so overview number). I will double check if things were working differently in the colormap topic before our changes/optimizations to this class.
 

In GDAL, overviews conceptually share the same palette than the main image. Otherwise subsampling RasterIO() will return values of the overview palette that will be interpreted with the palette of the main image. You can imagine the fun visual effects if the palette are not the same... So this is assumed, but not checked.

 

Could be worth fixing that if that cause issues (apparently in your use case at least), but I'd be interested by information of what is the standard/recommanded/best-practice-in-the-industry/etc... formulas to use for the mapping between the [0,255] and [0,65535] ranges.

 


Cheers,
Daniele 

>

> Best Regards,

> Daniele

>

> On Thu, Nov 24, 2016 at 1:35 PM, Even Rouault <[hidden email]>

>

> wrote:

> > Daniele,

> >

> >

> >

> > This is indeed an inconsistency I spotted a long time ago :

> >

> > https://trac.osgeo.org/gdal/ticket/2213

> >

> >

> >

> > Nobody was apparently sufficiently annoyed by this to fix it. Actually I

> > see I proposed a patch. Was probably waiting for feedback. I'm not sure if

> > there's a standardized way of converting between the [0,255] and [0,65535]

> > ranges.

> >

> >

> >

> > Even

> >

> > > Hi List,

> > >

> > > I'm investigating on a issue I have with a paletted image with

> > > overviews,

> > >

> > > using java ImageIO tiff reader (wait... I know on this list we discuss

> > >

> > > about GDAL topics :) ).

> > >

> > > I'm trying to better understand palette interpretation and palette

> >

> > storing

> >

> > > on tags and how they are handled by GDAL.

> > >

> > >

> > >

> > > From TIFF specifications, colormap entries are stored as short values.

> > >

> > > I have a sample file with this color tab (as reported by gdalinfo).

> > >

> > >

> > >

> > > Color Table (RGB with 256 entries)

> > >

> > > 0: *164*,164,164,255

> > >

> > > 1: *255*,255,255,255

> > >

> > > 2: 0,0,0,255

> > >

> > > 3: 0,0,0,255

> > >

> > > .... repeat 0,0,0,255 to the end.

> > >

> > >

> > >

> > > Using an Hex editor or AsTiffTagViewer, I can see the byte values of the

> > >

> > > colormap as stored on the file.

> > >

> > > For the first 4 mappings of the colortable the Red components are:

> > >

> > > *A4 A4* *FF FF* 00 00 00 00

> > >

> > > (8 bytes = 4 shorts)

> > >

> > >

> > >

> > > As far as I have understood, this is related to that part of the

> > >

> > > specification (quoting it, section 5):

> > >

> > >

> > >

> > >

> > >

> > > *In a TIFF ColorMap, all the Red values come first, followed by the

> > > Green

> > >

> > > values, then the Blue values. In the ColorMap, black is represented by

> > >

> > > 0,0,0 and white is represented by 65535, 65535, 65535*

> > >

> > >

> > >

> > > So the second entry of the map, being white (255, 255, 255) has its red

> > >

> > > value stored as 65535 = *FF FF *whilst the first color (164,164,164) has

> > >

> > > its red value stored as 42148 = *A4 A4*

> > >

> > >

> > >

> > > I see this behavior is confirmed by the way the geotiff.cpp create the

> > >

> > > colortable:

> > >

> > > https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/

> >

> > geotiff.cpp#L5043

> >

> > > panTRed[iColor] = static_cast<unsigned short>(257 * sRGB.c1);

> > >

> > > panTGreen[iColor] = static_cast<unsigned short>(257 * sRGB.c2);

> > >

> > > panTBlue[iColor] = static_cast<unsigned short>(257 * sRGB.c3)

> > >

> > >

> > >

> > > Applying a color*257 multiplication allows to have its 8 bits color

> > >

> > > representation stored into a short where intensity goes from 0 to 65535.

> > >

> > >

> > >

> > > The issue I have is that when using gdaladdo, the overviews are

> > > generated

> > >

> > > with a different color table.

> > >

> > > So that the first 8 bytes of the red component stored in the colormap,as

> > >

> > > reported by AsTiffTagViewer are:

> > >

> > > *A4* 00 *FF* 00 00 00 00 00

> > >

> > >

> > >

> > > When converting it back to a 0-255 color component with the formula

> > >

> > > R*255/65535 it become *163* instead of 164.

> > >

> > >

> > >

> > > I see in the GDAL code that both the IBuildOverviews and

> > >

> > > CreateOverviewsFromSrcOverviews call the CreateTIFFColorTable function

> > >

> > > which multiplies the colorMapEntry by 256 instead of 257.

> > >

> > >

> > >

> > > https://github.com/OSGeo/gdal/blob/trunk/gdal/frmts/gtiff/

> >

> > geotiff.cpp#L9137

> >

> > > This may explain the *A4* 00 *FF* 00 entries in the overview with

> > > respect

> > >

> > > to the *A4 A4 FF FF *entries in the main level.

> > >

> > >

> > >

> > > Do you have any feedback on this?

> > >

> > > Please, let me know what do you think about it.

> > >

> > >

> > >

> > > Best Regards,

> > >

> > > Daniele

> >

> > --

> >

> > Spatialys - Geospatial professional services

> >

> > http://www.spatialys.com

> >

> > _______________________________________________

> > gdal-dev mailing list

> > [hidden email]

> > http://lists.osgeo.org/mailman/listinfo/gdal-dev

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: <a href="tel:%2B39%200584%20962313" value="+390584962313" target="_blank">+39 0584 962313
fax:      <a href="tel:%2B39%200584%201660272" value="+3905841660272" target="_blank">+39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.





--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.



_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Ari Jolma-2
In reply to this post by Even Rouault-2
24.11.2016, 18:01, Even Rouault kirjoitti:

 

Could be worth fixing that if that cause issues (apparently in your use case at least), but I'd be interested by information of what is the standard/recommanded/best-practice-in-the-industry/etc... formulas to use for the mapping between the [0,255] and [0,65535] ranges.


At least in the GTK circles it seems to be a standard practice to use the 257 as the scaling factor. See for example

http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/Gdk/Color.html

Ari




_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3
JAI-ImageIO TIFFDecompressor does the same (Line 0888):
(also putting an imageio-ext link for quicker reference)

Note the:
redLut[i] = (byte)((colorMap[i]*255)/65535);
which results into using a 257 scale factor.

Cheers,
Daniele


On Fri, Nov 25, 2016 at 11:27 AM, Ari Jolma <[hidden email]> wrote:
24.11.2016, 18:01, Even Rouault kirjoitti:

 

Could be worth fixing that if that cause issues (apparently in your use case at least), but I'd be interested by information of what is the standard/recommanded/best-practice-in-the-industry/etc... formulas to use for the mapping between the [0,255] and [0,65535] ranges.


At least in the GTK circles it seems to be a standard practice to use the 257 as the scaling factor. See for example

http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/Gdk/Color.html

Ari




_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.



_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3
Hi Even,
I'm resurrecting this old post since I think we have (GeoServer) been hit by that problem again (although I'm not 100% sure about that).

Do you know if there is any plan to fix  https://trac.osgeo.org/gdal/ticket/2213?

Best Regards,
Daniele




On Fri, Nov 25, 2016 at 12:14 PM, Daniele Romagnoli <[hidden email]> wrote:
JAI-ImageIO TIFFDecompressor does the same (Line 0888):
(also putting an imageio-ext link for quicker reference)

Note the:
redLut[i] = (byte)((colorMap[i]*255)/65535);
which results into using a 257 scale factor.

Cheers,
Daniele


On Fri, Nov 25, 2016 at 11:27 AM, Ari Jolma <[hidden email]> wrote:
24.11.2016, 18:01, Even Rouault kirjoitti:

 

Could be worth fixing that if that cause issues (apparently in your use case at least), but I'd be interested by information of what is the standard/recommanded/best-practice-in-the-industry/etc... formulas to use for the mapping between the [0,255] and [0,65535] ranges.


At least in the GTK circles it seems to be a standard practice to use the 257 as the scaling factor. See for example

http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/Gdk/Color.html

Ari




_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: <a href="tel:+39%200584%20962313" value="+390584962313" target="_blank">+39 0584 962313
fax:      <a href="tel:+39%200584%20166%200272" value="+3905841660272" target="_blank">+39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

 

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.





--
Regards,
Daniele Romagnoli
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272


-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
 
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Even Rouault-2

On jeudi 8 mars 2018 15:32:09 CET Daniele Romagnoli wrote:

> Hi Even,

> I'm resurrecting this old post since I think we have (GeoServer) been hit

> by that problem again (although I'm not 100% sure about that).

> http://osgeo-org.1560.x6.nabble.com/Geotiff-pyramids-non-transparant-while-o

> riginal-is-transparent-td5357343.html

>

> Do you know if there is any plan to fix https://trac.osgeo.org/gdal/

> ticket/2213?

 

Daniele,

 

there was no "plan", but seing this is a 10-year long lasting issue made me sad, so I've just pushed a fix... As suggested in this discussion thread, I've used 257 as factor for multiplication/division hopefully all over the relevant places.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3
You are the man!

Thanks for that.
Do you know which GDAL versions will contain the fix?

Cheers,
Daniele

On Thu, Mar 8, 2018 at 3:55 PM, Even Rouault <[hidden email]> wrote:

On jeudi 8 mars 2018 15:32:09 CET Daniele Romagnoli wrote:

> Hi Even,

> I'm resurrecting this old post since I think we have (GeoServer) been hit

> by that problem again (although I'm not 100% sure about that).

> http://osgeo-org.1560.x6.nabble.com/Geotiff-pyramids-non-transparant-while-o

> riginal-is-transparent-td5357343.html

>

> Do you know if there is any plan to fix https://trac.osgeo.org/gdal/

> ticket/2213?

 

Daniele,

 

there was no "plan", but seing this is a 10-year long lasting issue made me sad, so I've just pushed a fix... As suggested in this discussion thread, I've used 257 as factor for multiplication/division hopefully all over the relevant places.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com




--
Regards,
Daniele Romagnoli
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272


-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
 
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Even Rouault-2

On jeudi 8 mars 2018 16:00:16 CET Daniele Romagnoli wrote:

> You are the man!

>

> Thanks for that.

> Do you know which GDAL versions will contain the fix?

 

2.2.4 and 2.3.0

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Troubleshooting palette management. Potential bug in palette for overviews?

Daniele Romagnoli-3
In reply to this post by Even Rouault-2
Hi Richard,
when investigating on an issue very similar to the ones you have reported, I have discovered that the problem was in the color map.
You may take a look on the details of my original report:

The outcome of that problem was that the colors of the geotiff with palette + overviews were changing when zooming out from native to overview.
So I think it could be related since, at the end, the transparent entry is a color itself.

Daniele 








On Thu, Mar 8, 2018 at 4:17 PM, Richard 🌍 Duivenvoorde <[hidden email]> wrote:
On 08-03-18 15:55, Even Rouault wrote:
> On jeudi 8 mars 2018 15:32:09 CET Daniele Romagnoli wrote:
>> I'm resurrecting this old post since I think we have (GeoServer) been hit
>> by that problem again (although I'm not 100% sure about that).
>
> http://osgeo-org.1560.x6.nabble.com/Geotiff-pyramids-non-transparant-while-o
>> riginal-is-transparent-td5357343.html

>> Do you know if there is any plan to fix https://trac.osgeo.org/gdal/ticket/2213?
>
> there was no "plan", but seing this is a 10-year long lasting issue made
> me sad, so I've just pushed a fix... As suggested in this discussion
> thread, I've used 257 as factor for multiplication/division hopefully
> all over the relevant places.

Thanks Even!

Looking at the patch, I understand it will fix a color map change, but
(my) original Geoserver issue [0] was about the transparency in
(apparently) the generated overview images.

Is that relevant in this case? Or is this only about actual colors?

Regards,

Richard Duivenvoorde

[0]
http://osgeo-org.1560.x6.nabble.com/Geotiff-pyramids-non-transparant-while-original-is-transparent-td5357343.html



--
Regards,
Daniele Romagnoli
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272


-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
 
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev