Even Rouault <even.rouault <at> mines-paris.org> writes: > > Selon Jukka Rahkonen <jukka.rahkonen <at> mmmtike.fi>: > > > Hi, > > > > I would like to know what happens if I convert an original RGBA tiff image > > into jpeg as > > > > gdal_translate -of jpeg rgba_in.tif jpeg_out.jpg > > > > I know that for getting a good result I can add "-b 1 -b 2 -b 3" but I am > > curious to know what happens and how GDAL computes sort of a transparent > > sepia coloured mask when run without selecting bands. > > It will result in a TIFF with separate bands (PLANARCONFIG_SEPARATE : > http://www.awaresystems.be/imaging/tiff/tifftags/planarconfiguration.html), each > of them JPEG compressed. So for a transparency mask with "instantenous" changes > between zones of fully transparence and fully opacity, you'll have JPEG > artifacts. > I'm wondering if the "sepia coloured mask" is not caused by a viewer that will > be confused by this TIFF configuration and would assume a CMYK color space > instead of RGB.
Hi Even, Sorry, I must have been unclear. The question was about writing out a real JPEG file, not JPEG compressed TIFF The original is of this type: Band 1 Block=5000x1 Type=Byte, ColorInterp=Red Band 2 Block=5000x1 Type=Byte, ColorInterp=Green Band 3 Block=5000x1 Type=Byte, ColorInterp=Blue Band 4 Block=5000x1 Type=Byte, ColorInterp=Undefined The command gdal_translate -of jpeg rgba_in.tif jpeg_out.jpg creates a jpeg file with this gdalinfo C:\Jukka>gdalinfo jpeg_out.jpg Driver: JPEG/JPEG JFIF Files: jpeg_out.jpg jpeg_out.jpg.aux.xml Size is 5000, 5000 Coordinate System is: PROJCS["NAD83 / Indiana West (ftUS)", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980",6378137,298.2572221010002, AUTHORITY["EPSG","7019"]], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433], AUTHORITY["EPSG","4269"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",37.5], PARAMETER["central_meridian",-87.08333333333333], PARAMETER["scale_factor",0.999966667], PARAMETER["false_easting",2952750], PARAMETER["false_northing",820208.333], UNIT["US survey foot",0.3048006096012192, AUTHORITY["EPSG","9003"]], AUTHORITY["EPSG","2966"]] Origin = (2947500.000000000000000,2265000.000000000000000) Pixel Size = (0.500000000000000,-0.500000000000000) Metadata: AREA_OR_POINT=Area TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch) TIFFTAG_XRESOLUTION=1 TIFFTAG_YRESOLUTION=1 Image Structure Metadata: COMPRESSION=JPEG INTERLEAVE=PIXEL SOURCE_COLOR_SPACE=CMYK Corner Coordinates: Upper Left ( 2947500.000, 2265000.000) ( 87d 6' 8.96"W, 41d27'59.66"N) Lower Left ( 2947500.000, 2262500.000) ( 87d 6' 8.95"W, 41d27'34.96"N) Upper Right ( 2950000.000, 2265000.000) ( 87d 5'36.12"W, 41d27'59.66"N) Lower Right ( 2950000.000, 2262500.000) ( 87d 5'36.12"W, 41d27'34.96"N) Center ( 2948750.000, 2263750.000) ( 87d 5'52.54"W, 41d27'47.31"N) Band 1 Block=5000x1 Type=Byte, ColorInterp=Red Overviews: 2500x2500, 1250x1250, 625x625 Image Structure Metadata: COMPRESSION=JPEG Band 2 Block=5000x1 Type=Byte, ColorInterp=Green Overviews: 2500x2500, 1250x1250, 625x625 Image Structure Metadata: COMPRESSION=JPEG Band 3 Block=5000x1 Type=Byte, ColorInterp=Blue Overviews: 2500x2500, 1250x1250, 625x625 Image Structure Metadata: COMPRESSION=JPEG The mask I told can be seen in this stackexchange question on the left side of the image. I do not believe that a viewer plays any role here. http://gis.stackexchange.com/questions/101393/gdal-tif-to-jpg-creates-dark-image -Jukka- _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev