Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image transparency is buggy #3364

Open
mki-c2c opened this issue Aug 5, 2024 · 0 comments
Open

Image transparency is buggy #3364

mki-c2c opened this issue Aug 5, 2024 · 0 comments

Comments

@mki-c2c
Copy link

mki-c2c commented Aug 5, 2024

Context

  • MapFish print version: 3.30
  • Java version: docker image camptocamp/mapfish_print:3.30
  • OS: docker image

Describe the bug

If an image is included in the print spec with opacity != 1, the colors get completely out of control. Ther might be a pixmap roundoff error somewhere. Problem also mentioned in #2971

Below, included a very basic "rainbow" in base64 encoding.

When generating the print for different layer opacities, one can observe the color errors.

json is very simplified to allow for upload. Very low res image, low DPI (1)
However, the behaviour is identical for higher resolutions and larger included images

{
    "attributes": {
        "map": {
            "dpi": 1,
            "rotation": 0,
            "scale": 1,
            "center": [
                390,
                244
            ],
            "layers": [
                {
                    "type": "image",
                    "baseURL": "data:image/bmp;base64,Qk36AAAAAAAAAHoAAABsAAAACgAAAAQAAAABABgAAAAAAIAAAAAjLgAAIy4AAAAAAAAAAAAAQkdScwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAA5lvV/5P/h4T/IW8INMkFKP8Zb/8A1MMAgRUARwMAACy6ZNT5mfuLiNRMfDhOmShB3Chz8Cauowx1HQFGBAAAW4tuzdq41a+up3mJWF95Y2yhaoOuU4F+LlM0GC8ZAABre3HKz8PIu7uYiI5jZW53eo2AiZhicnE6RzwfKCAAAA==",
                    "extent": [
                        0,
                        0,
                        780,
                        489
                    ],
                    "opacity": 0.9
                }
            ]
        },
        "title": "opacity: 0.9"
    },
    "printLegend": 0,
    "format": "png",
    "layout": "A4 landscape simple"
}

Actual results

Opacity 1 correct, opactiy < 1 incorrect
opacity 1:
image
opacity 0.9:
image

opacity 0.8- 0.1:







no special logs, everything seems successful

mfp_1         | 08:22:58.029 [http-nio-8080-exec-10] INFO  o.m.p.s.j.impl.ThreadPoolJobManager - Submitted print job 4161520f-03cb-41a6-9346-2f36a4879ece@3e465eac-b754-4e9b-8cff-8cdbaac77dfb
mfp_1         | 08:22:58.030 [PrintJobManager-3] INFO  o.mapfish.print.servlet.job.PrintJob - Starting print job 4161520f-03cb-41a6-9346-2f36a4879ece@3e465eac-b754-4e9b-8cff-8cdbaac77dfb
mfp_1         | 08:22:58.034 [ForkJoinPool-1-worker-251] INFO  o.m.p.processor.ProcessorGraphNode - Time taken to run processor: 'class org.mapfish.print.processor.jasper.JasperReportBuilder' was 0 ms
mfp_1         | 08:22:59.906 [ForkJoinPool-1-worker-251] INFO  o.m.p.processor.ProcessorGraphNode - Time taken to run processor: 'class org.mapfish.print.processor.map.CreateMapProcessor' was 1872 ms
mfp_1         | 08:22:59.907 [PrintJobManager-3] INFO  o.mapfish.print.output.ValuesLogger - This log message details the parameters available for use in the Jasper templates for
mfp_1         |   Mapfish Template: A4 landscape simple
mfp_1         |   Jasper Template name: report_simple.jrxml
mfp_1         |   The following parameters are available for use in the templates: 
mfp_1         |     * template (org.mapfish.print.config.Template)
mfp_1         |     * layerGraphics (java.util.ArrayList)
mfp_1         |     * mapSubReport (java.lang.String)
mfp_1         |     * values (org.mapfish.print.output.Values)
mfp_1         |     * REPORT_LOCALE (java.util.Locale)
mfp_1         |     * SUBREPORT_DIR (java.lang.String)
mfp_1         |     * title (java.lang.String)
mfp_1         |     * jobId (java.lang.String)
mfp_1         |     * pdfConfig (org.mapfish.print.config.PDFConfig)
mfp_1         |     * requestHeaders (org.mapfish.print.attribute.HttpRequestHeadersAttribute$Value)
mfp_1         |     * mapContext (org.mapfish.print.attribute.map.MapfishMapContext)
mfp_1         |     * REPORT_RESOURCE_BUNDLE (java.util.PropertyResourceBundle)
mfp_1         |     * clientHttpRequestFactoryProvider (org.mapfish.print.processor.http.MfClientHttpRequestFactoryProvider)
mfp_1         |     * tempTaskDirectory (java.io.File)
mfp_1         |     * map (org.mapfish.print.attribute.map.MapAttribute$MapAttributeValues)
mfp_1         | 
mfp_1         | 08:23:00.981 [PrintJobManager-3] INFO  o.mapfish.print.servlet.job.PrintJob - Successfully completed print job 4161520f-03cb-41a6-9346-2f36a4879ece@3e465eac-b754-4e9b-8cff-8cdbaac77dfb

Expected results

This is the original "rainbow" (10x4px) interpolated by the browser.

To view the original file, use the html tag below (it seems impossible to include css in github markdown:

<img src=https://github.com/user-attachments/assets/a50ad9a9-feaa-431b-a52f-4400bc2e9a36 width=300 style="image-rendering:pixelated">

rendered with opacity = 1

for opacities < 1 the colors should stay consistent

@mki-c2c mki-c2c changed the title Image tranparency is buggy Image transparency is buggy Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant