LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-13-2008, 01:05 PM   #1
NaCo
Member
 
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");
imagegif($dst_img);//imagejpeg($dst_img,"",85);

// Destroy images
imagedestroy($src_img);
imagedestroy($dst_img);

------------------------------------------------------------------------


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: http://10-network.net/image_thumbial/bulb_gif.gif
Resized image: http://10-network.net/image_thumbial/index.php

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, 03:53 PM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
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, 06:19 PM   #3
simonapnic
Member
 
Registered: Jul 2008
Posts: 70

Rep: Reputation: 16
Post

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:
http://www.imagemagick.org/pipermail/
 
Old 07-14-2008, 02:10 AM   #4
NaCo
Member
 
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 (www.php.net/gd) with the GD library(www.libgd.org).

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.
 
  


Reply



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 03:55 PM
Black background/white text = bad aesthetics? vharishankar General 7 01-04-2005 06:19 PM
Background for posting textbox white? vharishankar LQ Suggestions & Feedback 2 11-11-2004 06:09 PM
Highlights on Menus: text = white, background = grey GexNZ Linux - Software 1 07-31-2004 11:41 PM
wierd white background with xsane shellcode Linux - General 0 02-27-2004 12:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:05 AM.

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