Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 07-13-2008, 02:05 PM   #1
Registered: Jun 2002
Location: L.A.
Distribution: Fedora
Posts: 46

Rep: Reputation: 15
Talking Resizing images with white background

Hello community,

I am using the following script to resize .gif images; It works very decent:
$src_img =imagecreatefromgif("bulb_gif.gif");
$srcsize = getimagesize('bulb_gif.gif');
$dest_x = 200;
$dest_y = (200/ $srcsize[0]) * $srcsize[1];//resize ratio.
$dst_img = imagecreatetruecolor($dest_x, $dest_y);

// Resize image
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]);

// Output image
header("content-type: image/gif");

// Destroy images


The problem is when resizing images with white background (not transparency), after the script is executed the image background turns not being 100% white (255,255,255). Links:

Original .gif file:
Resized image:

You can notice the difference between the resized image and the page background. This varies from LCD to LCD, I can tell the difference in my main screen is about 75%, in othe screens I have around this is about 90%.

Any help will be gently apreciated.

Thank you.
Old 07-13-2008, 04:53 PM   #2
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,437
Blog Entries: 1

Rep: Reputation: 66
You are right ! Now only the white is not white (in fact it is #fcfefc) but the yellow has changed to. In the original image it is #f7c000 and in the small resized image it is #f4c204 !
I do not recognize the API you are using. What it is this API/language ?
For sure is a problem with the functions you are using.

Try to find a forum for that specific API and post your findings and/or try to contact the development team of that API.
Old 07-13-2008, 07:19 PM   #3
Registered: Jul 2008
Posts: 70

Rep: Reputation: 16

It looks like you're using the ImageMagick library for your PHP script.
It could be a known bug, so check out their mailing lists, which are available at:
Old 07-14-2008, 03:10 AM   #4
Registered: Jun 2002
Location: L.A.
Distribution: Fedora
Posts: 46

Original Poster
Rep: Reputation: 15
Php Gd

Sorry, I totally forgot to mentioned what scripting language I am using, it is PHP ( with the GD library(

Yes this is somehow strange. I am not an expert using this library, being this the reason to seek some help.

It is not imagemagick it is GD.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound has background white noise. SUSE 9.1 Ralph Fant Linux - Software 1 08-19-2005 04:55 PM
Black background/white text = bad aesthetics? vharishankar General 7 01-04-2005 07:19 PM
Background for posting textbox white? vharishankar LQ Suggestions & Feedback 2 11-11-2004 07:09 PM
Highlights on Menus: text = white, background = grey GexNZ Linux - Software 1 08-01-2004 12:41 AM
wierd white background with xsane shellcode Linux - General 0 02-27-2004 01:12 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration