Index: src/main/java/info/magnolia/imaging/operations/load/AbstractLoader.java =================================================================== --- src/main/java/info/magnolia/imaging/operations/load/AbstractLoader.java (revision 58442) +++ src/main/java/info/magnolia/imaging/operations/load/AbstractLoader.java (working copy) @@ -74,18 +74,27 @@ if (loaded == null) { throw new ImagingException("Could not load image for " + filterParams); } - final BufferedImage img = new BufferedImage(loaded.getWidth(), loaded.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE); - final Graphics2D g = img.createGraphics(); if (backgroundColor != null) { + //This line produces an empty BufferedImage with an alpha channel. String this BufferedImage into JCR or as file into the system as: + // - jpg: jpg does not have an alpha channel. Creates an image where the alpha value is used as a color -> black image + // - png: works perfectly because PNGs do have an alpha channel. + + final BufferedImage img = new BufferedImage(loaded.getWidth(), loaded.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE); + + // This would work fine for jpg because determining an BufferedImage without an alpha channel + //final BufferedImage img = new BufferedImage(loaded.getWidth(), loaded.getHeight(), BufferedImage.TYPE_INT_RGB); + + final Graphics2D g = img.createGraphics(); g.setColor(backgroundColor); g.fill(new Rectangle(0, 0, img.getWidth(), img.getHeight())); + g.drawImage(loaded, null, 0, 0); + g.dispose(); + + return img; } - g.drawImage(loaded, null, 0, 0); - // TODO would this make any difference ? g.drawRenderedImage(loaded, null); - g.dispose(); - return img; + return loaded; } protected abstract BufferedImage loadSource(P filterParams) throws ImagingException;