Imagecopymergegrey

Okay, what rediculously simple thing am i missing here…

Preface: $res exists and is correctly retrieving ~40 records.


<?php 
$col = 0;
$srow = 0;
$out = imagecreate(384,(64*ceil($res->num_rows/6)));
while($row = $res->fetch_array()) {
 $source = imagecreatefromjpeg('gametiles/'.$row['id'].'.jpg'); //This line works.
 imagecopymergegray($out,$source,(64*$col),(64*$srow),0,0,64,64,(100*$row['achieved'])); //This one doesnt?
 $col++;
 if ($col == 6) { 
   $col = 0;
   $srow++;
 }
}
header('Content-type: image/png');
imagepng($out); //Displays a correctly-sized black box.
?>

Nevermind. Replaced


imagecopymergegray($out,$source,(64*$col),(64*$srow),0,0,64,64,(100*$row['achieved']));

with


 imagecopymergegray($source,$source,0,0,0,0,64,64,(100*$row['achieved']));
 imagecopy($out,$source,(64*$col),(64*$srow),0,0,64,64);

and it works correctly.