php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20866 Wrong XPM format
Submitted: 2002-12-06 12:29 UTC Modified: 2002-12-06 18:32 UTC
From: gilles_gros at yahoo dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 4CVS-2002-12-06 (stable) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gilles_gros at yahoo dot com
New email:
PHP Version: OS:

 

 [2002-12-06 12:29 UTC] gilles_gros at yahoo dot com
This is a follow-up on bug 20839.

The XPM format is now supported in the GD extension :)

I have noticed that some XPM icons are not properly converted to PNG.

My analysis of the problem is that when the color definition is :

static char * XPM_icon[] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 9 1 -1 -1",
/* colors */
"       c #DEDEDFDFDEDE",
".      c #212120202121",
"X      c #737371717373",
"o      s iconColor1    m black c black",
"O      s iconColor6    m white c yellow",
"+      s iconColor4    m white c green",
"@      c #ADADAEAEADAD",
"#      c #636361616363",
"$      s iconColor3    m black c red",
/* pixels */
...

the color conversion is not right.
I do not know if it is GD or the use of GD in PHP that is not doing the right work.

But if you have the color definition like :

static char * XPM_icon[] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 9 1 -1 -1",
/* colors */
"       c #DEDEDFDFDEDE",
".      c #212120202121",
"X      c #737371717373",
"o      c #000000000000",
"O      c #FFFFFFFF0000",
"+      c #0000FFFF0000",
"@      c #ADADAEAEADAD",
"#      c #636361616363",
"$      c #FFFF00000000",
/* pixels */
...

everything is fine.

Hope this will help make gd extension better.

Here are 2 XPMs. 

=======
XPM color wrong :

static char * app_php_http_gwy[] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 9 1 -1 -1",
/* colors */
"       c #DEDEDFDFDEDE",
".      c #212120202121",
"X      c #737371717373",
"o      s iconColor1    m black c black",
"O      s iconColor6    m white c yellow",
"+      s iconColor4    m white c green",
"@      c #ADADAEAEADAD",
"#      c #636361616363",
"$      s iconColor3    m black c red",
/* pixels */
"                                ",
"             ........           ",
"             X......            ",
"    X    X    Xo                ",
"   XOXXXXOX    Xoo              ",
"  XOOOOOOOOX    X o             ",
" XOOOOOOOOOOX   oo              ",
"X++++++++++++XXo      X     @   ",
"#++++++++++++X Xoo   XO@@XXXO@  ",
" #$$$$$$$$$$X   X o XOOOOOOOOO@ ",
"  #$$$$$$$$X    oo #OOOOOOOOOOO@",
"   #$####$X   Xo    #OOOOOOOOOX ",
"    #    X     Xoo   #O#####OX  ",
"   XOXXXXOX     X o   #     @   ",
"  XOOOOOOOOX    oo   X+@@XXX+@  ",
" XOOOOOOOOOOX Xo    X+++++++++@ ",
"X++++++++++++X Xoo #+++++++++++@",
"#++++++++++++X  X o #+++++++++X ",
" #$$$$$$$$$$X   oo   #+#####+X  ",
"  #$$$$$$$$X  Xo      #     @   ",
"   #$####$X    Xoo   X$@@XXX$@  ",
"    #    X      X o X$$$$$$$$$@ ",
"   XOXXXXOX     oo #$$$$$$$$$$$@",
"  XOOOOOOOOX  Xo    #$$$$$$$$$X ",
" XOOOOOOOOOOX  Xoo   #$#####$X  ",
"X++++++++++++X  X o   #     #   ",
"#++++++++++++X  oo              ",
" #$$$$$$$$$$X Xo                ",
"  #$$$$$$$$X   Xoo              ",
"   #$####$X     X o             ",
"    #    X    oooooo            ",
"             ........           "};


========================================
XPM color right :

static char * app_php_http_gwy[] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 9 1 -1 -1",
/* colors */
"       c #DEDEDFDFDEDE",
".      c #212120202121",
"X      c #737371717373",
"o      c #000000000000",
"O      c #FFFFFFFF0000",
"+      c #0000FFFF0000",
"@      c #ADADAEAEADAD",
"#      c #636361616363",
"$      c #FFFF00000000",
/* pixels */
"                                ",
"             ........           ",
"             X......            ",
"    X    X    Xo                ",
"   XOXXXXOX    Xoo              ",
"  XOOOOOOOOX    X o             ",
" XOOOOOOOOOOX   oo              ",
"X++++++++++++XXo      X     @   ",
"#++++++++++++X Xoo   XO@@XXXO@  ",
" #$$$$$$$$$$X   X o XOOOOOOOOO@ ",
"  #$$$$$$$$X    oo #OOOOOOOOOOO@",
"   #$####$X   Xo    #OOOOOOOOOX ",
"    #    X     Xoo   #O#####OX  ",
"   XOXXXXOX     X o   #     @   ",
"  XOOOOOOOOX    oo   X+@@XXX+@  ",
" XOOOOOOOOOOX Xo    X+++++++++@ ",
"X++++++++++++X Xoo #+++++++++++@",
"#++++++++++++X  X o #+++++++++X ",
" #$$$$$$$$$$X   oo   #+#####+X  ",
"  #$$$$$$$$X  Xo      #     @   ",
"   #$####$X    Xoo   X$@@XXX$@  ",
"    #    X      X o X$$$$$$$$$@ ",
"   XOXXXXOX     oo #$$$$$$$$$$$@",
"  XOOOOOOOOX  Xo    #$$$$$$$$$X ",
" XOOOOOOOOOOX  Xoo   #$#####$X  ",
"X++++++++++++X  X o   #     #   ",
"#++++++++++++X  oo              ",
" #$$$$$$$$$$X Xo                ",
"  #$$$$$$$$X   Xoo              ",
"   #$####$X     X o             ",
"    #    X    oooooo            ",
"             ........           "};

======================

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-06 18:32 UTC] sniper@php.net
GD bug, not PHP bug. Report it to the GD author.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 11:01:36 2025 UTC