Bug 231057 - graphics/gd: Wrong renderig of .gif
Summary: graphics/gd: Wrong renderig of .gif
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Dirk Meyer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-31 13:05 UTC by Pascal Christen
Modified: 2018-12-30 14:07 UTC (History)
4 users (show)

See Also:
dinoex: maintainer-feedback+


Attachments
How it looks (5.44 KB, image/png)
2018-08-31 13:05 UTC, Pascal Christen
no flags Details
How it should looks like (4.64 KB, image/png)
2018-08-31 13:10 UTC, Pascal Christen
no flags Details
Simple Test case in C (592 bytes, text/plain)
2018-09-15 11:55 UTC, Dirk Meyer
no flags Details
Test Script for resizing .gif (343 bytes, text/plain)
2018-09-18 06:49 UTC, Pascal Christen
no flags Details
Test .gif (2.42 KB, image/gif)
2018-09-18 06:54 UTC, Pascal Christen
no flags Details
output (860 bytes, image/gif)
2018-09-20 09:28 UTC, Dirk Meyer
no flags Details
old output.gif (608 bytes, image/gif)
2018-09-20 10:39 UTC, Dirk Meyer
no flags Details
code to reproduce the problem in plain C (578 bytes, text/plain)
2018-09-20 10:40 UTC, Dirk Meyer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Christen 2018-08-31 13:05:12 UTC
Created attachment 196745 [details]
How it looks

Hi

We have the problem, if we build php-gd (7.0,7.1,7.2) against the gdlib and not against the bundled PHP version - like PHP5.6 does (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217222) - .gif doesnt rendering correct for example in Contao 3.5.35.

I tried to build php72-gd against the bundled gdlib-version and it worked that way. So is it may better to create this bug at graphics/gd ?

Greetings Pascal
Comment 1 Pascal Christen 2018-08-31 13:10:15 UTC
Created attachment 196746 [details]
How it should looks like
Comment 2 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2018-09-05 07:58:15 UTC
(In reply to Pascal Christen from comment #0)

> So is it may better to create this bug at graphics/gd

Yes, this would be the better way. Since we no longer use the bundled version, the bug must be located in graphics/gd.

As i a work around we can think about using bundled or ports version of graphics/gd an option.

But currently i'm having not much time. My family has grown and this has prio. :D

I added joneum@ to the cc. If you can up with an patch to fix the issue, he will test and commit it! :)

Greetings,
Torsten
Comment 3 Pascal Christen 2018-09-07 09:12:48 UTC
(In reply to Torsten Zuehlsdorff from comment #2)

Ok thanks Torsten!


@Dirk Meyer <dinoex@FreeBSD.org>
Should we try to fix it here or create an issue at https://github.com/libgd/libgd/issues ?
Comment 4 Dirk Meyer freebsd_committer freebsd_triage 2018-09-15 11:53:57 UTC
(In reply to Pascal Christen from comment #3)

I can not reproduce the problem on FreeBSD 11.2 amd64

Do you have any sources to reproduce the issue with plain "graphics/libgd" ?
Comment 5 Dirk Meyer freebsd_committer freebsd_triage 2018-09-15 11:55:59 UTC
Created attachment 197108 [details]
Simple Test case in C
Comment 6 Pascal Christen 2018-09-18 06:49:43 UTC
Created attachment 197185 [details]
Test Script for resizing .gif
Comment 7 Pascal Christen 2018-09-18 06:54:59 UTC
Created attachment 197186 [details]
Test .gif

You can try this gif
Comment 8 Dirk Meyer freebsd_committer freebsd_triage 2018-09-20 09:28:07 UTC
Created attachment 197264 [details]
output

output from script
Comment 9 Pascal Christen 2018-09-20 09:32:27 UTC
(In reply to Dirk Meyer from comment #8)

yes and in PHP5.6 with bundled GD the background doesn't look like this...
Comment 10 Dirk Meyer freebsd_committer freebsd_triage 2018-09-20 10:38:09 UTC
The generate files looks fine with "xv".
Dependent on the decoder they look different.

gif2text shows some some difference:
-       ColorResolution = 3, BitsPerPixel = 6, BackGround = 0, Aspect = 0.
+       ColorResolution = 6, BitsPerPixel = 6, BackGround = 0, Aspect = 0.

+       ColorResolution = 6, BitsPerPixel = 6, BackGround = 0, Aspect = 0.
        Global Color Map:
        Sort Flag: off
-  0: 6ch 6eh 6ch     1: b4h b2h b4h     2: 94h 92h 94h     3: d4h d2h d4h   
-  4: 84h 82h 84h     5: c4h c2h c4h     6: a4h a2h a4h     7: e4h e2h e4h   
-  8: 7ch 7ah 7ch     9: bch bah bch    10: 9ch 9ah 9ch    11: dch dah dch   
- 12: 8ch 8ah 8ch    13: cch cah cch    14: ach aah ach    15: 74h 76h 74h   
- 16: ech eah ech    17: 74h 72h 74h    18: b4h b6h b4h    19: 94h 96h 94h   
- 20: d4h d6h d4h    21: 84h 86h 84h    22: c4h c6h c4h    23: a4h a6h a4h   
- 24: 7ch 7eh 7ch    25: bch beh bch    26: 9ch 9eh 9ch    27: dch deh dch   
- 28: 8ch 8eh 8ch    29: cch ceh cch    30: ach aeh ach    31: ech eeh ech   
- 32: 00h 00h 00h    33: 00h 00h 00h    34: 00h 00h 00h    35: 00h 00h 00h   
+  0: 04h 02h 04h     1: 7ch 7ah 7ch     2: b4h b6h b4h     3: 9ch 9ah 9ch   
+  4: d4h d6h d4h     5: 8ch 8ah 8ch     6: c4h c6h c4h     7: ach aah ach   
+  8: ech eah ech     9: 6ch 6eh 6ch    10: 84h 82h 84h    11: bch beh bch   
+ 12: a4h a2h a4h    13: dch deh dch    14: 94h 92h 94h    15: cch ceh cch   
+ 16: b4h b2h b4h    17: 74h 76h 74h    18: 7ch 7eh 7ch    19: bch bah bch   
+ 20: 9ch 9eh 9ch    21: dch dah dch    22: 8ch 8eh 8ch    23: cch cah cch   
+ 24: ach aeh ach    25: ech eeh ech    26: 74h 72h 74h    27: 84h 86h 84h   
+ 28: c4h c2h c4h    29: a4h a6h a4h    30: e4h e2h e4h    31: 94h 96h 94h   
+ 32: d4h d2h d4h    33: 00h 00h 00h    34: 00h 00h 00h    35: 00h 00h 00h   

-       Transparent Index: 32
+       Transparent Index: 33

I see no easy fix here,
please create an issue at https://github.com/libgd/libgd/issues

I will attach a C-Source you can send as sample.
Comment 11 Dirk Meyer freebsd_committer freebsd_triage 2018-09-20 10:39:17 UTC
Created attachment 197268 [details]
old output.gif

old output, that shows the expected result.
Comment 12 Dirk Meyer freebsd_committer freebsd_triage 2018-09-20 10:40:30 UTC
Created attachment 197269 [details]
code to reproduce the problem in plain C
Comment 13 Dirk Meyer freebsd_committer freebsd_triage 2018-09-20 10:42:26 UTC
confirmed it is not an php issue
Comment 14 Pascal Christen 2018-09-20 11:21:13 UTC
(In reply to Dirk Meyer from comment #13)

Wow, thank you Dirk! Yes I just updated the bug on Github: https://github.com/libgd/libgd/issues/473

I'm trying to improve my C-Skills ;)
Comment 15 Jochen Neumeister freebsd_committer freebsd_triage 2018-11-11 20:02:56 UTC
any news here?
Comment 16 Pascal Christen 2018-11-12 08:07:12 UTC
(In reply to Jochen Neumeister from comment #15)

GitHub Issue is still unresovled.
Comment 17 Pascal Christen 2018-12-27 14:06:38 UTC
https://gist.github.com/cmb69/c319f61e38ef10099657393ba7522236

seems working for me. I'll contact the developer tomorrow about his release plans otherwise I'll just cherry-pick this patch.
Comment 18 commit-hook freebsd_committer freebsd_triage 2018-12-30 14:01:20 UTC
A commit references this bug:

Author: dinoex
Date: Sun Dec 30 14:00:46 UTC 2018
New revision: 488716
URL: https://svnweb.freebsd.org/changeset/ports/488716

Log:
  - fix rendering of gif
  PR:		231057
  Obtained from:	https://github.com/libgd/libgd/issues/473

Changes:
  head/graphics/gd/Makefile
  head/graphics/gd/files/patch-gd.c