Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/06/2008, 10:49
Avatar de PabloSutra
PabloSutra
 
Fecha de Ingreso: octubre-2006
Ubicación: Guadalajara, México
Mensajes: 222
Antigüedad: 17 años, 6 meses
Puntos: 0
PNG Transparente

Que tal Foreros, bueno mi problema es el siguiente, estoy haciendo un sistema de recortes de caras con Flash y PHP, y cuando hago imprimo la pantalla en Flash y le mando los datos a PHP, me genera un PNG transparente, hasta ahi bien ya que si lo hace, lo malo es que me sale el alias, y pues eso no deberia de salir, alguien sabe como podria corregirlo?, les pongo la parte del codigo donde se genera la imagen, lo que hago desde Flash es pasarle pixel por pixel el codigo del color, y al final para hacerlo transparente le quito el fondo negro, este es el codigo:

Código PHP:
$w = (int)$_POST['width'];
$h = (int)$_POST['height'];

$img imagecreatetruecolor($w$h);

$rows 0;
$cols 0;


for(
$rows 0$rows $h$rows++){
    
    
$c_row explode(","$_POST['px' $rows]);
    for(
$cols 0$cols $w$cols++){
        
// get the single pixel color value
        
$value $c_row[$cols];
        
// if value is not empty (empty values are the blank pixels)
        
if($value != ""){
            
// get the hexadecimal string (must be 6 chars length)
            // so add the missing chars if needed
            
$hex $value;
            while(
strlen($hex) < 6){
                
$hex "0" $hex;
            }
            
// convert value from HEX to RGB
            
$r hexdec(substr($hex02));
            
$g hexdec(substr($hex22));
            
$b hexdec(substr($hex42));
            
// allocate the new color
            // N.B. teorically if a color was already allocated 
            // we dont need to allocate another time
            // but this is only an example
            
$test imagecolorallocate($img$r$g$b);
            
// and paste that color into the image
            // at the correct position
            
imagesetpixel($img$cols$rows$test);
        }
    }
}

$userDir _DOCUMENT_HOST_.'/app/files/Recortes/'.$User->id;

header("Content-type:image/png");
imagecolortransparent($img,0x000000);
imagepng($img,$userDir."/caras/cara".time().".png");

$new_width 500;
$new_height 350
En fin, espero me puedan ayudar, desde ya muchas gracias.

SALUD!!!!!