Question Details

No question body available.

Tags

java javafx firefox

Answers (1)

June 4, 2026 Score: 0 Rep: 131 Quality: Low Completeness: 80%

Answer

After investigating the issue, I found that the image data itself is valid, but all pixels have an alpha value of zero.

For example:

00A1BE3E
00B0AFB4
009EBB3B

The format returned by PixelReader.getArgb() is:

AA RR GG BB

So:

00 A1 BE 3E
^^
Alpha = 0

The RGB channels contain valid color information, but every pixel is fully transparent.

This explains why:

  • Clipboard.hasImage() returns true

  • Clipboard.getImage() returns a valid image

  • PixelReader is available

  • Width and height are correct

  • No exceptions are thrown

  • Nothing appears in the ImageView

In my case, this only occurred when copying images from Firefox on Windows 10.

A workaround is to reconstruct the image and force the alpha channel to 255:

Image image = clipboard.getImage();

PixelReader pr = image.getPixelReader();

WritableImage fixed = new WritableImage( (int) image.getWidth(), (int) image.getHeight());

PixelWriter pw = fixed.getPixelWriter();

for (int y = 0; y < image.getHeight(); y++) { for (int x = 0; x < image.getWidth(); x++) {

int argb = pr.getArgb(x, y);

// Force alpha to 255 argb |= 0xFF000000;

pw.setArgb(x, y, argb); } }

imageView.setImage(fixed);

After restoring the alpha channel, the image becomes visible immediately.

The clipboard formats reported by Firefox were:

application/x-java-rawimage
PNG
application/x-moz-nativeimage
text/html

This suggests a compatibility issue somewhere in the conversion path between Firefox's clipboard formats and JavaFX's Image representation. The RGB data is preserved correctly, but the alpha channel is lost and becomes zero for all pixels.