Skip to content

Fix tiff loader for tiffs with transparency #236

@akoch-yatta

Description

@akoch-yatta

The Tiff loading seems to break when loading a tiff with included transparency, e.g. tiff_image.zip

Error

 org.eclipse.swt.SWTException: Unsupported color depth
	at org.eclipse.swt.SWT.error(SWT.java:4932)
	at org.eclipse.swt.SWT.error(SWT.java:4847)
	at org.eclipse.swt.SWT.error(SWT.java:4818)
	at org.eclipse.swt.internal.image.TIFFDirectory.parseEntries(TIFFDirectory.java:374)
	at org.eclipse.swt.internal.image.TIFFDirectory.read(TIFFDirectory.java:450)
	at org.eclipse.swt.internal.image.TIFFFileFormat.loadFromByteStream(TIFFFileFormat.java:65)
	at org.eclipse.swt.internal.image.FileFormat.loadFromStream(FileFormat.java:77)
	at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:99)
	at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:154)
	at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:179)
	at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:29)
	at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:380)
	at org.eclipse.swt.graphics.Image$ImageFileNameProviderWrapper.getImageMetadata(Image.java:2147)
	at org.eclipse.swt.graphics.Image.getImageMetadata(Image.java:782)
	at org.eclipse.swt.graphics.Image.win32_getHandle(Image.java:821)
	at org.eclipse.swt.graphics.Image.createGdipImage(Image.java:1009)
	at org.eclipse.swt.graphics.GC.drawImage(GC.java:1026)
	at org.eclipse.swt.graphics.GC.drawImage(GC.java:1020)
	at org.eclipse.draw2d.SWTGraphics.drawImage(SWTGraphics.java:466)
	at org.eclipse.draw2d.ScaledGraphics.drawImage(ScaledGraphics.java:270)
	at org.eclipse.draw2d.Graphics.drawImage(Graphics.java:176)

Snippet to reproduce

public class Snippet1 {

public static void main (String [] args) {
	new ImageLoader().load("c:\\Users\\akoch\\Downloads\\tiff_image.tiff");
}
}

Metadata

Metadata

Assignees

Labels

BugA Derivation of Expected BehaviorHiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions