Bug #457

psimage does not do transparency

Added by Remko over 3 years ago. Updated over 3 years ago.

Status:ClosedStart date:2013-12-07
Priority:NormalDue date:
Assignee:Remko% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:Mac OS X

Description

  1. When psimage plots a jpg or png that includes a transparent colour, the transparency does not show up in the result. Instead a solid colour is shown.
    This can probably not be solved. I'm not sure that there is a good interface in the code right now to support a transparent colour straight from the image file.
    This is Sun Raster heritage.
  2. When assigning a colour to be transparent using the option -Gt in psimage, the background colour is actually not replaced.
    This is a discrepancy with what the manual says.
    The manual also needs to be updated to talk less about Sun Raster files since gdal should be able to load most other image formats.

Associated revisions

Revision 12617
Added by Remko over 3 years ago

Partial fix of issue #457. This fixes part 2), but not part 1)

Revision 12618
Added by Remko over 3 years ago

Partial fix of issue #457. This fixes part 1. Part 2 was already done.

Revision 12762
Added by Remko over 3 years ago

Properly handle transparent PNG images.
This fixes issue #457

History

#1 Updated by Paul over 3 years ago

We should add some test scripts for this. If the transparent color is known then it should be possible to tell color image that, but perhaps the GMT_IMAGE struct need to retain more information from GDAL?

#2 Updated by Remko over 3 years ago

Paul wrote:

We should add some test scripts for this.

I just added test/psimage/transparency.sh to test this. Oddly enough -Gtblack works, but not any other. Also reading PNG files does not work properly.

If the transparent color is known then it should be possible to tell color image that, but perhaps the GMT_IMAGE struct need to retain more information from GDAL?

That is probably needed, indeed.

#3 Updated by Remko over 3 years ago

Part 2 is fixed in r12617.
I made test/psimage/transparency.sh to test this.

#4 Updated by Remko over 3 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Part 1 is fixed in r12618.
Now properly handles transparent GIFs, also when the transparent colour appears elsewhere in the image.

#5 Updated by Paul over 3 years ago

  • Status changed from Resolved to Closed

Closing this issue as fixed.

#6 Updated by Paul over 3 years ago

  • Status changed from Closed to In Progress

Reopened as not working for 32-bit images

#7 Updated by Remko over 3 years ago

  • % Done changed from 100 to 50

We need a fix for PNG (and probably other) 32-bit images. I suggest to only deal with RGBA images where A is either 0 or 255.
Otherwise we issue a warning and do no transparency.
Note that the -Gt option allows to set/overwrite the transparent colour. This should be honoured as well.

#8 Updated by Remko over 3 years ago

  • Status changed from In Progress to Resolved

Transparent PNG images with either transparency 0 or 255 are handled properly now.
See r12762.

#9 Updated by Remko over 3 years ago

  • % Done changed from 50 to 100

#10 Updated by Paul over 3 years ago

  • Status changed from Resolved to Closed

Closing this issue.

Also available in: Atom PDF