RE: Bad picture colors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin you really save my ass!!
imagecopyresampled() is what I need.
It is 3 times slower but how cares, I run it in a local server.

Thank you vary much!

  _____  

 
Γατσής Νίκος - Gatsis Nikos
Web developer
tel.: 2108256721 - 2108256722
fax: 2108256712
email: ngatsis@xxxxxxx
http://www.qbit.gr 

-----Original Message-----
From: Martin Alterisio [mailto:malterisio777@xxxxxxxxx] 
Sent: Thursday, April 27, 2006 10:50 PM
To: nikos
Cc: PHP-mailist (PHP-mailist)
Subject: Re:  Bad picture colors

2006/4/27, nikos <nikos@xxxxxxx>:
>
> Hello list
>
> I use the following code to shrink some photos.
>
> $directory='/var/www/html/offroads/tmp/';
>         $dir=opendir($directory);
>         while($file=readdir($dir)) {
>                 $dirfile=$directory.$file;
>                 if(is_file($dirfile)) {
>                         copy($dirfile,$directory."sm/sm_".$file);
>                         $imgReal = ImageCreateFromJPEG($dirfile);
>                         $x = ImagesX($imgReal);
>                         $y = ImagesY($imgReal);
>                         $newX=$x*0.1783;
>                         $newY=$y*0.1783;
>                         $img = ImageCreate($newX,$newY);
>                         ImageCopyResized($img, $imgReal, 0, 0, 0, 0,
> $newX,
> $newY, $x, $y);
>                         //$newimg=imagecolorstotal($img);
>                         ImageJPEG($img,$directory."sm/sm_".$file);
>                         clearstatcache();
>                 }
>         }
>         closedir($dir);
>
> My problem is that the color results are very bad. How can I take picture
> with good colors?
>
> Thank you
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Try using imagecopyresampled() instead of imagecopyresized(). It uses a more
precise algorithm which means: more time to complete. But since it seems
you're creating a cache of resized images that won't mather once the resize
its done.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux