imageantialias
Description
The imageantialias of Image for PHP should antialias functions be used or not.
Syntax
imageantialias( GdImage $image, bool $enable ): bool
Parameters
image
A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().
enable
Whether to enable antialiasing or not.
Return
Returns true on success or false on failure.
Examples
1 · return
<? $width = 100; $height = 100; $image = imagecreate($width, $height); $enable = true; $return = imageantialias($image, $enable); var_export($return);
true
2 · base64 · enable · false
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $enable = false; imageantialias($image, $enable); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $x1 = 0; $y1 = 25; $x2 = 100; $y2 = 75; imageline($image, $x1, $y1, $x2, $y2, $color); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>';
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAlklEQVR4nO3QQQnAABDEwPNvemuheZXCjIKQOwAAAAAAAADe2/Z1wq9ss6yxLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyyzLLMssyzzCwAAAAAAALi7B5aGKuS9neP6AAAAAElFTkSuQmCC"> </body> </html>
3 · base64 · enable · true
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $enable = true; imageantialias($image, $enable); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $x1 = 0; $y1 = 25; $x2 = 100; $y2 = 75; imageline($image, $x1, $y1, $x2, $y2, $color); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>';
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw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zshL4g4XA4fn9/XS4Xl8uFviDhdDqbzeb+/j7DMNAXJLa2tlqt1u7uLnQEj52dHZZloReEEEIIIYQQQgghhBBCCCGEEHj/ANPXLTgeSx+lAAAAAElFTkSuQmCC"> </body> </html>
Links
Image
- gd_info
- getimagesize
- getimagesizefromstring
- image_type_to_extension
- image_type_to_mime_type
- imageaffine
- imageaffinematrixconcat
- imageaffinematrixget
- imagealphablending
- imagearc
- imageavif
- imagebmp
- imagechar
- imagecharup
- imagecolorallocate
- imagecolorallocatealpha
- imagecolorat
- imagecolorclosest
- imagecolorclosestalpha
- imagecolorclosesthwb
- imagecolordeallocate
- imagecolorexact
- imagecolorexactalpha
- imagecolormatch
- imagecolorresolve
- imagecolorresolvealpha
- imagecolorset
- imagecolorsforindex
- imagecolorstotal
- imagecolortransparent
- imageconvolution
- imagecopy
- imagecopymerge
- imagecopymergegray
- imagecopyresampled
- imagecopyresized
- imagecreate
- imagecreatefromavif
- imagecreatefrombmp
- imagecreatefromgif
- imagecreatefromjpeg
- imagecreatefrompng
- imagecreatefromstring
- imagecreatefromtga
- imagecreatefromwbmp
- imagecreatefromwebp
- imagecreatefromxbm
- imagecreatefromxpm
- imagecreatetruecolor
- imagecrop
- imagecropauto
- imagedashedline
- imagedestroy
- imageellipse
- imagefill
- imagefilledarc
- imagefilledellipse
- imagefilledpolygon
- imagefilledrectangle
- imagefilltoborder
- imagefilter
- imageflip
- imagefontheight
- imagefontwidth
- imageftbbox
- imagefttext
- imagegammacorrect
- imagegetclip
- imagegetinterpolation
- imagegif
- imageinterlace
- imageistruecolor
- imagejpeg
- imagelayereffect
- imageline
- imageloadfont
- imageopenpolygon
- imagepalettecopy
- imagepalettetotruecolor
- imagepng
- imagepolygon
- imagerectangle
- imageresolution
- imagerotate
- imagesavealpha
- imagescale
- imagesetbrush
- imagesetclip
- imagesetinterpolation
- imagesetpixel
- imagesetstyle
- imagesetthickness
- imagesettile
- imagestring
- imagestringup
- imagesx
- imagesy
- imagetruecolortopalette
- imagettfbbox
- imagettftext
- imagetypes
- imagewbmp
- imagewebp
- imagexbm
- iptcembed
- iptcparse