[MGNLIMG-131] Revise image type assignments Created: 22/Apr/14  Updated: 04/Jun/14  Resolved: 22/Apr/14

Status: Closed
Project: Imaging
Component/s: image operations
Affects Version/s: 3.0.3
Fix Version/s: 3.0.4

Type: Task Priority: Neutral
Reporter: Roman Kovařík Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: maintenance, support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MGNLIMG-132 CLONE - Revise image type assignments Closed
causality
Template:
Acceptance criteria:
Empty
Task DoR:
Empty

 Description   

Currently we do image type assignment at least on two places:

info.magnolia.imaging.operations.load.AbstractLoader.apply(BufferedImage, P) {
        ...
        int imageType = loaded.getType(); // set the output image type to the source image type

        if (imageType == BufferedImage.TYPE_CUSTOM) { // if the source image type is not set...
            if (loaded.getAlphaRaster() != null) { // with alpha channel
                imageType = BufferedImage.TYPE_INT_ARGB_PRE;
            } else { // without alpha channel
                imageType = BufferedImage.TYPE_INT_RGB;
            }
        }
        ...
}
info.magnolia.imaging.operations.cropresize.resizers.MultiStepResizer.resize(BufferedImage, Coords, Size) {
        ...
        final int type = (src.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
        ...
}

This two assignments should be in sync (e.g. create info.magnolia.imaging.util.ImageUtil.getImageType(BufferedImage)).
A part of this function could be also fix for loosing transparency of an indexed transparent image, see SUPPORT-3443.


Generated at Mon Feb 12 02:12:35 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.