$image = newImage();
if (decodeImageFile($image, "testsuite/tif/4.2.04.tif")) {
    print "image decoded all fine.\n";
} else {
    print "something went wrong ...\n";
    exit;
}
if (encodeImageFile($image, "test.jpg", 80, "")) {
    print "image written all fine.\n";
} else {
    print "something went wrong writing the image ...\n";
    exit;
}
# advanced use, use in memory locations
$image_bits = `cat testsuite/tif/5.1.13.tif`;
if (decodeImage($image, $image_bits)) {
    print "image read from RAM.\n";
} else {
    print "something went wrong decoding the RAM\n";
    exit;
}
# image properties
print "Width: " . imageWidth($image) . "\n";
print "Height: " . imageHeight($image) . "\n";
print "Xres: " . imageXres($image) . "\n";
print "Yres: " . imageYres($image) . "\n";
print "Channels: " . imageChannels($image) . "\n";
print "Channel depth: " . imageChannelDepth($image) . "\n";
# setable as well
imageSetXres($image, 144);
imageSetYres($image, 144);
Esempio n. 2
0
            imagesetpixel($i, $x, $y, imagecolorallocate($i, $r, $g, $b));
            $n++;
        }
    }
    //imagepng($i, 'test.png');
    return $i;
}
$gameFolder = 'c:/juegos/brave_s';
foreach (glob("{$gameFolder}/scenario/*.dat") as $fileIn) {
    $fileOut = substr($fileIn, 0, -4) . '.scr';
    echo "{$fileIn} -> {$fileOut}\n";
    if (!file_exists($fileOut)) {
        file_put_contents($fileOut, decrypt_data(file_get_contents($fileIn)));
    }
}
foreach (glob("{$gameFolder}/map/*.dat") as $fileIn) {
    $fileOut = substr($fileIn, 0, -4) . '.scr';
    echo "{$fileIn} -> {$fileOut}\n";
    if (!file_exists($fileOut)) {
        file_put_contents($fileOut, decrypt_data(file_get_contents($fileIn)));
    }
}
foreach (glob("{$gameFolder}/parts/*.CRP") as $fileIn) {
    $fileOut1 = substr($fileIn, 0, -4) . '.CRP.u';
    $fileOut2 = substr($fileIn, 0, -4) . '.PNG';
    echo "{$fileIn} -> {$fileOut2}\n";
    if (!file_exists($fileOut2)) {
        `ms-expand.exe {$fileIn} {$fileOut1}`;
        imagepng(decodeImage(fopen($fileOut1, 'rb')), $fileOut2);
    }
}