[GRASS-dev] [grass-code I][329] r.out.gdal: COMPRESS=JPEG yields "ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG"

code I item #329, was opened at 2007-03-09 23:07
Status: Open
Priority: 3
Submitted By: Maciej Sieczka (msieczka)
Assigned to: Nobody (None)
Summary: r.out.gdal: COMPRESS=JPEG yields "ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG"
Issue type: module bug
Issue status: None
GRASS version: CVS HEAD
GRASS component: raster
Operating system: all
Operating system version:
GRASS CVS checkout date, if applies (YYMMDD): 070308

Initial Comment:
In spearfish:

$ g.region rast=vegcover
$ r.out.gdal input=vegcover format=GTiff type=Byte output=tmp/vegcover_jpg.tif createopt=COMPRESS=JPEG

100%
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
Done!

Maciek

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

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=329&group_id=21

Maciej wrote:

In spearfish:

$ g.region rast=vegcover
$ r.out.gdal input=vegcover format=GTiff type=Byte output=tmp/vegcover_jpg.tif createopt=COMPRESS=JPEG

100%
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
Done!

This bug still applies. I don't know why "format=GTiff type=Byte
createopt=COMPRESS=JPEG" do not work together. The output raster is all
black. According to GeoTIFF spec JPEG compression should work just fine
with integer raster: "JPEG should only be used with Byte data" [1].

[1]http://www.gdal.org/frmt_gtiff.html

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=329&group_id=21

Maciej Sieczka wrote:

> In spearfish:
>
> $ g.region rast=vegcover
> $ r.out.gdal input=vegcover format=GTiff type=Byte output=tmp/vegcover_jpg.tif createopt=COMPRESS=JPEG
>
> 100%
> ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
> ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
> ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
> ERROR 1: JPEGSetupEncode:PhotometricInterpretation 3 not allowed for JPEG
> Done!

This bug still applies. I don't know why "format=GTiff type=Byte
createopt=COMPRESS=JPEG" do not work together. The output raster is all
black. According to GeoTIFF spec JPEG compression should work just fine
with integer raster: "JPEG should only be used with Byte data" [1].

I thought that I had replied to this already.

...

Oh; I did, but none of the addresses in the original message accept
replies, so it went into the bit-bucket.

r.out.gdal creates paletted images (i.e. the map data is saved as a
single band; it isn't expanded to RGB).

Note that the argument to creatopt= is passed directly to GDAL.
r.out.gdal has no knowledge of which options are allowed or
meaningful, so it's up to the user not to pass options which won't work.

Glynn Clements wrote:

Maciej Sieczka wrote:

This bug still applies. I don't know why "format=GTiff type=Byte
createopt=COMPRESS=JPEG" do not work together. The output raster is all
black. According to GeoTIFF spec JPEG compression should work just fine
with integer raster: "JPEG should only be used with Byte data" [1].

I thought that I had replied to this already.

...

Oh; I did, but none of the addresses in the original message accept
replies, so it went into the bit-bucket.

Too bad, yes.

r.out.gdal creates paletted images (i.e. the map data is saved as a
single band; it isn't expanded to RGB).

Note that the argument to creatopt= is passed directly to GDAL.
r.out.gdal has no knowledge of which options are allowed or
meaningful, so it's up to the user not to pass options which won't work.

I guess I comply.

In spearfish:

$ g.region rast=vegcover
$ r.out.gdal in=vegcover format=GTiff type=Byte
out=tmp/vegcover_jpg.tif createopt=COMPRESS=JPEG

Is there something wrong with: "format=GTiff type=Byte
createopt=COMPRESS=JPEG" when exporting an integer raster, value range 1-6:

In spearfish:

$ r.info -t vegcover
datatype=CELL

$ r.info -r vegcover
min=1
max=6

in the context of what GDAL's GeoTIFF spec says: "JPEG should only be
used with Byte data"?

[1]http://www.gdal.org/frmt_gtiff.html

Maciek

Maciej Sieczka wrote:

>> r.out.gdal creates paletted images (i.e. the map data is saved as a
>> single band; it isn't expanded to RGB).
>>
>> Note that the argument to creatopt= is passed directly to GDAL.
>> r.out.gdal has no knowledge of which options are allowed or
>> meaningful, so it's up to the user not to pass options which won't work.

I guess I comply.

In spearfish:

$ g.region rast=vegcover
$ r.out.gdal in=vegcover format=GTiff type=Byte
out=tmp/vegcover_jpg.tif createopt=COMPRESS=JPEG

Is there something wrong with: "format=GTiff type=Byte
createopt=COMPRESS=JPEG" when exporting an integer raster, value range 1-6:

Yes; the use of createopt=COMPRESS=JPEG.

In spearfish:

$ r.info -t vegcover
datatype=CELL

$ r.info -r vegcover
min=1
max=6

in the context of what GDAL's GeoTIFF spec says: "JPEG should only be
used with Byte data"?

[1]http://www.gdal.org/frmt_gtiff.html

r.out.gdal creates paletted images, to which JPEG compression cannot
be applied.

IOW, regardless of which other options you use,
createopt=COMPRESS=JPEG will always result in an error.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements wrote:

Maciej Sieczka wrote:

r.out.gdal creates paletted images (i.e. the map data is saved as a
single band; it isn't expanded to RGB).

Note that the argument to creatopt= is passed directly to GDAL.
r.out.gdal has no knowledge of which options are allowed or
meaningful, so it's up to the user not to pass options which won't work.

I guess I comply.

In spearfish:

$ g.region rast=vegcover
$ r.out.gdal in=vegcover format=GTiff type=Byte
out=tmp/vegcover_jpg.tif createopt=COMPRESS=JPEG

Is there something wrong with: "format=GTiff type=Byte
createopt=COMPRESS=JPEG" when exporting an integer raster, value range 1-6:

Yes; the use of createopt=COMPRESS=JPEG.

In spearfish:

$ r.info -t vegcover
datatype=CELL

$ r.info -r vegcover
min=1
max=6

in the context of what GDAL's GeoTIFF spec says: "JPEG should only be
used with Byte data"?

[1]http://www.gdal.org/frmt_gtiff.html

r.out.gdal creates paletted images, to which JPEG compression cannot
be applied.

IOW, regardless of which other options you use,
createopt=COMPRESS=JPEG will always result in an error.

OK. Closing bug as invalid.

Maciek