<?php
int imagegetinterpolation ( GdImage $image )
where,
$image = The image identifier
?>
IMAGE INTERPOLATION CONSTANTS | ||
CONSTANT | VALUE | MEANING |
IMG_BELL | 1 | Bell filter |
IMG_BESSEL | 2 | Bessel filter |
IMG_BILINEAR_FIXED | 3 | Fixed point implementation of the bilinear interpolation |
IMG_BICUBIC | 4 | Bicubic interpolation |
IMG_BICUBIC_FIXED | 5 | Fixed point implementation of the bicubic interpolation |
IMG_BLACKMAN | 6 | Blackman window function |
IMG_BOX | 7 | Box blur filter |
IMG_BSPLINE | 8 | Spline interpolation |
IMG_CATMULLROM | 9 | Cubic Hermite spline interpolation |
IMG_GAUSSIAN | 10 | Gaussian function |
IMG_GENERALIZED_CUBIC | 11 | Generalized cubic spline fractal interpolation |
IMG_HERMITE | 12 | Hermite interpolation |
IMG_HAMMING | 13 | Hamming filter |
IMG_HANNING | 14 | Hanning filter |
IMG_MITCHELL | 15 | Mitchell filter |
IMG_NEAREST_NEIGHBOUR | 16 | Nearest neighbour interpolation |
IMG_POWER | 17 | Power interpolation |
IMG_QUADRATIC | 18 | Inverse quadratic interpolation |
IMG_SINC | 19 | Sinc function |
IMG_TRIANGLE | 20 | Triangle interpolation |
IMG_WEIGHTED4 | 21 | Weighting filter |
ed48 |
<?php
if(PHP_MAJOR_VERSION >= 8)
{
$image01 = 'gif/GIF 029 01.gif';
$img_interp = 'gif/GIF 029 01 interpolation.gif';
$intrp01 = [
"IMG_BELL" => IMG_BELL,
"IMG_BESSEL" => IMG_BESSEL,
"IMG_BILINEAR_FIXED" => IMG_BILINEAR_FIXED,
"IMG_BICUBIC" => IMG_BICUBIC,
"IMG_BICUBIC_FIXED" => IMG_BICUBIC_FIXED,
"IMG_BLACKMAN" => IMG_BLACKMAN,
"IMG_BOX" => IMG_BOX,
"IMG_BSPLINE" => IMG_BSPLINE,
"IMG_CATMULLROM" => IMG_CATMULLROM,
"IMG_GAUSSIAN" => IMG_GAUSSIAN,
"IMG_GENERALIZED_CUBIC" => IMG_GENERALIZED_CUBIC,
"IMG_HERMITE" => IMG_HERMITE,
"IMG_HAMMING" => IMG_HAMMING,
"IMG_HANNING" => IMG_HANNING,
"IMG_MITCHELL" => IMG_MITCHELL,
"IMG_NEAREST_NEIGHBOUR" => IMG_NEAREST_NEIGHBOUR,
"IMG_POWER" => IMG_POWER,
"IMG_QUADRATIC" => IMG_QUADRATIC,
"IMG_SINC" => IMG_SINC,
"IMG_TRIANGLE" => IMG_TRIANGLE,
"IMG_WEIGHTED4" => IMG_WEIGHTED4
];
foreach($intrp01 as $k => $v)
echo "$v = $k <br>";
// For values outside the range [1, 21]
// the assumed value will always be 3 as the default.
echo '<br>' . basename($image01) .
'<br><br>Existing Image</span>'; ?><br><br>
<img src="<?php echo $image01; ?>"
alt="<?php echo $image01; ?> "
title="<?php echo $image01; ?>"><br><br>
<?php
$id_img01 = imagecreatefromgif($image01);
$gintrp01 = imagegetinterpolation($id_img01);
echo basename($img_interp) .
'<br><br>After interpolation = ' . $gintrp01; ?><br><br>
<img src="<?php echo $img_interp; ?>"
alt="<?php echo $img_interp; ?> "
title="<?php echo $img_interp; ?>"><br><br>
<?php
}
else
{
echo 'This function is not available
for this version of PHP<br>';
}
?>