Bug 42028 - Incorrect rendering of GIF images
Summary: Incorrect rendering of GIF images
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: all
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-02 22:22 UTC by Trejkaz (pen name)
Modified: 2012-04-07 01:51 UTC (History)
0 users



Attachments
gif-scaling-bug.zip (5.81 KB, application/octet-stream)
2007-04-02 22:22 UTC, Trejkaz (pen name)
Details
Proposed patch (4.47 KB, patch)
2007-04-02 22:39 UTC, Trejkaz (pen name)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Trejkaz (pen name) 2007-04-02 22:22:22 UTC
Attached zip file contains an example with a single GIF, which exhibits two
problems:
  1. the GIF is scaled in a strange fashion, and 
  2. the black lines are lost.
Comment 1 Trejkaz (pen name) 2007-04-02 22:22:48 UTC
Created attachment 19896 [details]
gif-scaling-bug.zip
Comment 2 Trejkaz (pen name) 2007-04-02 22:23:50 UTC
I may have a fix for #1 -- ImageIOImage was using the image data array to
determine the image size, which isn't necessarily the case for GIF.
Comment 3 Trejkaz (pen name) 2007-04-02 22:39:26 UTC
Created attachment 19897 [details]
Proposed patch

Attached patch uses the ImageIO metadata DOM to obtain the width and height, as
well as the horizontal and vertical pixel offset.  When building the bitmap
array, offsets the stored image pixels.

I'm not sure how to solve problem #2 though.
Comment 4 Trejkaz (pen name) 2007-04-03 00:06:43 UTC
Some investigation of #2, inside ImageIOImage#loadBitmap:

alphas = { 0, 255, 255, 255 }
reds   = { 0,   0, 187,   1 }
greens = { 0,   0, 224,   2 }
blues  = { 0,   0, 227,   3 }

The first palette colour is the transparent colour, which is black.  The second
colour, which is *not* transparent, also happens to be black.

FOP assumes that the transparent colour doesn't occur anywhere in the image, yet
in this situation it does.

Maybe it would be possible to pick an RGB combo which doesn't exist in the
image, recolour all the transparent pixels to that colour and then set that as
the transparentColor field.  That way it wouldn't clash with real drawn pixels
which happened to have the same colour.
Comment 5 Glenn Adams 2012-04-07 01:41:43 UTC
resetting P2 open bugs to P3 pending further review