[gdal-dev] RGB to PALETTE conversion

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

[gdal-dev] RGB to PALETTE conversion

Paulo Pires
Hello,

I'm trying to convert RGB image to PALETTE image with PIL:

/img = Image.open(tiffile)
img = img1convert("P", palette=Image.ADAPTIVE, colors=256)
img.save(newtiffile+"_index.tif")    
img.close()/

...but, for example, the white color is 245, not 255 :(

And from CMYK to PALETTE? Is it possible? gdal option, please...

Thanks




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: RGB to PALETTE conversion

Paulo Pires
theres any help, please?

RGB to Palette...
CMYK to Palette...

Thanks



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: RGB to PALETTE conversion

Chris Smemoe
Paulo,

Are you trying to convert a file with multiple bands (RGB or RGBA) to a file
with a single band and a color palette?  One possible solution showing how
to do this using GDAL is shown on Stack Exchange at the following location:

https://gis.stackexchange.com/questions/246045/export-geotiff-with-color-tab
le-from-web-service-using-gdal-translate/259414#259414

Somebody might have something better.

I imagine you could use a similar solution to handle CMYK images.

Chris

-----Original Message-----
From: gdal-dev [mailto:[hidden email]] On Behalf Of Paulo
Pires
Sent: Sunday, February 04, 2018 4:30 AM
To: [hidden email]
Subject: Re: [gdal-dev] RGB to PALETTE conversion

theres any help, please?

RGB to Palette...
CMYK to Palette...

Thanks



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

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

Re: RGB to PALETTE conversion

jratike80
In reply to this post by Paulo Pires
Paulo Pires wrote
> theres any help, please?
>
> RGB to Palette...
> CMYK to Palette...
>
> Thanks

Have you tried http://www.gdal.org/rgb2pct.html?

-Jukka Rahkonen-



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: RGB to PALETTE conversion

Paulo Pires
This post was updated on .
Thanks Chris Smemoe and jratike80,

I found a solution, thanks to you both. I create my palette image in
photoshop, then with gdal, I create my VRT from that image and then, all my
next images with the same colors with rgb2pct...

Like a charm.

If you know best approach, please let-me know.

Thanks, once again!



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev