Π€ΡƒΠ½ΠΊΡ†ΠΈΠΈ GD ΠΈ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ для Ρ€Π°Π±ΠΎΡ‚Ρ‹ с изобраТСниями

Π‘ΠΎΠ΄Π΅Ρ€ΠΆΠ°Π½ΠΈΠ΅

  • gd_info β€” Π’Ρ‹Π²ΠΎΠ΄ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΠΈ ΠΎ Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΉ установлСнной GD Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠ΅
  • getimagesize β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ Ρ€Π°Π·ΠΌΠ΅Ρ€ изобраТСния
  • getimagesizefromstring β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Ρ€Π°Π·ΠΌΠ΅Ρ€Π° изобраТСния ΠΈΠ· строки Π΄Π°Π½Π½Ρ‹Ρ…
  • image_type_to_extension β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ Ρ„Π°ΠΉΠ»Π° для Ρ‚ΠΈΠΏΠ° изобраТСния
  • image_type_to_mime_type β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Mime-Ρ‚ΠΈΠΏΠ° для Ρ‚ΠΈΠΏΠ° изобраТСния, Π²ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅ΠΌΠΎΠ³ΠΎ функциями getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
  • image2wbmp β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ записываСт Π² Ρ„Π°ΠΉΠ»
  • imageaffine β€” Π’Π΅Ρ€Π½ΡƒΡ‚ΡŒ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅, содСрТащСС Π°Ρ„Ρ„ΠΈΠ½Π½ΠΎ-ΠΏΡ€Π΅ΠΎΠ±Ρ€Π°Π·ΠΎΠ²Π°Π½Π½ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ src, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡ Π΄ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½ΡƒΡŽ ΠΎΠ±Π»Π°ΡΡ‚ΡŒ ограничСния
  • imageaffinematrixconcat β€” ΠšΠΎΠ½ΠΊΠ°Ρ‚Π΅Π½ΠΈΡ€ΡƒΠ΅Ρ‚ Π΄Π²Π΅ Π°Ρ„Ρ„ΠΈΠ½Π½Ρ‹Π΅ ΠΌΠ°Ρ‚Ρ€ΠΈΡ†Ρ‹ прСобразования
  • imageaffinematrixget β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ ΠΌΠ°Ρ‚Ρ€ΠΈΡ†Ρƒ Π°Ρ„Ρ„ΠΈΠ½Π½ΠΎΠ³ΠΎ прСобразования
  • imagealphablending β€” УстанавливаСт Ρ€Π΅ΠΆΠΈΠΌ сопряТСния Ρ†Π²Π΅Ρ‚ΠΎΠ² для изобраТСния
  • imageantialias β€” ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅Ρ‚, ΠΏΡ€ΠΈΠΌΠ΅Π½ΡΡ‚ΡŒ Π»ΠΈ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ сглаТивания
  • imagearc β€” РисуСт Π΄ΡƒΠ³Ρƒ
  • imageavif β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ записываСт Π² Ρ„Π°ΠΉΠ»
  • imagebmp β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ BMP-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ Ρ„Π°ΠΉΠ»
  • imagechar β€” РисуСт символ ΠΏΠΎ Π³ΠΎΡ€ΠΈΠ·ΠΎΠ½Ρ‚Π°Π»ΠΈ
  • imagecharup β€” РисуСт символ ΠΏΠΎ Π²Π΅Ρ€Ρ‚ΠΈΠΊΠ°Π»ΠΈ
  • imagecolorallocate β€” Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Ρ†Π²Π΅Ρ‚Π° для изобраТСния
  • imagecolorallocatealpha β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Ρ†Π²Π΅Ρ‚ для изобраТСния
  • imagecolorat β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ индСкса Ρ†Π²Π΅Ρ‚Π° пиксСла
  • imagecolorclosest β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ блиТайший индСкс Ρ†Π²Π΅Ρ‚Π°
  • imagecolorclosestalpha β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ блиТайший индСкс Ρ†Π²Π΅Ρ‚Π° с ΡƒΡ‡Ρ‘Ρ‚ΠΎΠΌ прозрачности
  • imagecolorclosesthwb β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ индСкс Ρ†Π²Π΅Ρ‚Π° с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌΠΈ Ρ‚ΠΎΠ½ΠΎΠΌ, Π±Π΅Π»ΠΈΠ·Π½ΠΎΠΉ ΠΈ Π·Π°Ρ‚Π΅ΠΌΠ½Π΅Π½ΠΈΠ΅ΠΌ
  • imagecolordeallocate β€” УдаляСт Ρ†Π²Π΅Ρ‚ ΠΈΠ· ΠΏΠ°Π»ΠΈΡ‚Ρ€Ρ‹ изобраТСния
  • imagecolorexact β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ индСкс Ρ†Π²Π΅Ρ‚Π°
  • imagecolorexactalpha β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ индСкс Ρ†Π²Π΅Ρ‚Π° ΠΈ Π°Π»ΡŒΡ„Π°-ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ‚Π°
  • imagecolormatch β€” ΠŸΡ€ΠΈΠ±Π»ΠΈΠΆΠ°Π΅Ρ‚ Ρ†Π²Π΅Ρ‚Π° ΠΏΠ°Π»ΠΈΡ‚Ρ€ΠΎΠ²ΠΎΠ³ΠΎ изобраТСния ΠΊ truecolor-вСрсии
  • imagecolorresolve β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ ΠΈΠ΄Π΅Π½Ρ‚ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€ ΠΊΠΎΠ½ΠΊΡ€Π΅Ρ‚Π½ΠΎΠ³ΠΎ Ρ†Π²Π΅Ρ‚Π° ΠΈΠ»ΠΈ Π΅Π³ΠΎ блиТайший Π°Π½Π°Π»ΠΎΠ³
  • imagecolorresolvealpha β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ ΠΈΠ΄Π΅Π½Ρ‚ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€ ΠΊΠΎΠ½ΠΊΡ€Π΅Ρ‚Π½ΠΎΠ³ΠΎ Ρ†Π²Π΅Ρ‚Π° ΠΈ Π°Π»ΡŒΡ„Π°-ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ‚Π° ΠΈΠ»ΠΈ Π΅Π³ΠΎ блиТайший Π°Π½Π°Π»ΠΎΠ³
  • imagecolorset β€” УстанавливаСт Π½Π°Π±ΠΎΡ€ Ρ†Π²Π΅Ρ‚ΠΎΠ² для индСкса ΠΏΠ°Π»ΠΈΡ‚Ρ€Ρ‹
  • imagecolorsforindex β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Ρ†Π²Π΅Ρ‚ΠΎΠ², ΡΠΎΠΎΡ‚Π²Π΅Ρ‚ΡΡ‚Π²ΡƒΡŽΡ‰ΠΈΡ… индСксу
  • imagecolorstotal β€” ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅Ρ‚ количСство Ρ†Π²Π΅Ρ‚ΠΎΠ² Π² ΠΏΠ°Π»ΠΈΡ‚Ρ€Π΅ изобраТСния
  • imagecolortransparent β€” ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅Ρ‚ Ρ†Π²Π΅Ρ‚ ΠΊΠ°ΠΊ ΠΏΡ€ΠΎΠ·Ρ€Π°Ρ‡Π½Ρ‹ΠΉ
  • imageconvolution β€” НалоТСниС ΠΈΡΠΊΡ€ΠΈΠ²Π»ΡΡŽΡ‰Π΅ΠΉ ΠΌΠ°Ρ‚Ρ€ΠΈΡ†Ρ‹ 3Ρ…3, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡ коэффициСнт ΠΈ смСщСниС
  • imagecopy β€” ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅Ρ‚ Ρ‡Π°ΡΡ‚ΡŒ изобраТСния
  • imagecopymerge β€” ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅Ρ‚ Ρ‡Π°ΡΡ‚ΡŒ изобраТСния с Π½Π°Π»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ
  • imagecopymergegray β€” ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅Ρ‚ Ρ‡Π°ΡΡ‚ΡŒ изобраТСния с Π½Π°Π»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ Π² градациях сСрого
  • imagecopyresampled β€” ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅Ρ‚ ΠΈ измСняСт Ρ€Π°Π·ΠΌΠ΅Ρ€ части изобраТСния с рСсСмплированиСм
  • imagecopyresized β€” ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅Ρ‚ ΠΈ измСняСт Ρ€Π°Π·ΠΌΠ΅Ρ€ части изобраТСния
  • imagecreate β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΏΠ°Π»ΠΈΡ‚Ρ€ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅
  • imagecreatefromavif β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefrombmp β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromgd β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π½Π° основС GD-Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromgd2 β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π½Π° основС GD2-Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromgd2part β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π½Π° основС части GD2-Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromgif β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromjpeg β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefrompng β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromstring β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· прСдставлСнного строкой ΠΏΠΎΡ‚ΠΎΠΊΠ°
  • imagecreatefromtga β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromwbmp β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromwebp β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromxbm β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatefromxpm β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„Π°ΠΉΠ»Π° ΠΈΠ»ΠΈ URL-адрСса
  • imagecreatetruecolor β€” Π‘ΠΎΠ·Π΄Π°Ρ‘Ρ‚ Π½ΠΎΠ²ΠΎΠ΅ truecolor-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅
  • imagecrop β€” ΠžΠ±Ρ€Π΅Π·Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π΄ΠΎ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°
  • imagecropauto β€” ΠžΠ±Ρ€Π΅Π·Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ автоматичСски Π½Π° основС Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ Ρ€Π΅ΠΆΠΈΠΌΠ°
  • imagedashedline β€” РисуСт ΠΏΡƒΠ½ΠΊΡ‚ΠΈΡ€Π½ΡƒΡŽ линию
  • imagedestroy β€” Π£Π½ΠΈΡ‡Ρ‚ΠΎΠΆΠ°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅
  • imageellipse β€” РисуСт эллипс
  • imagefill β€” Π—Π°Π»ΠΈΠ²Π°Π΅Ρ‚ Ρ„ΠΎΠ½
  • imagefilledarc β€” РисуСт ΠΈ Π·Π°Π»ΠΈΠ²Π°Π΅Ρ‚ Π΄ΡƒΠ³Ρƒ
  • imagefilledellipse β€” РисуСт эллипс с Π·Π°Π»ΠΈΠ²ΠΊΠΎΠΉ
  • imagefilledpolygon β€” РисуСт Π·Π°ΠΊΡ€Π°ΡˆΠ΅Π½Π½Ρ‹ΠΉ ΠΌΠ½ΠΎΠ³ΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ
  • imagefilledrectangle β€” РисуСт ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ с Π·Π°Π»ΠΈΠ²ΠΊΠΎΠΉ
  • imagefilltoborder β€” Π—Π°Π»ΠΈΠ²Π°Π΅Ρ‚ ΠΎΠ±Π»Π°ΡΡ‚ΡŒ изобраТСния
  • imagefilter β€” ΠŸΡ€ΠΈΠΌΠ΅Π½ΡΠ΅Ρ‚ Ρ„ΠΈΠ»ΡŒΡ‚Ρ€ ΠΊ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΡŽ
  • imageflip β€” ΠžΡ‚Ρ€Π°ΠΆΠ°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΏΠΎ осям
  • imagefontheight β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ высоты ΡˆΡ€ΠΈΡ„Ρ‚Π°
  • imagefontwidth β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΡˆΠΈΡ€ΠΈΠ½Ρ‹ ΡˆΡ€ΠΈΡ„Ρ‚Π°
  • imageftbbox β€” ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅Ρ‚ Π³Ρ€Π°Π½ΠΈΡ†Ρ‹ ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΎΠ³ΠΎ обрамлСния для тСкста, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠ° freetype2 Π²Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ Π½Π° экран ΠΏΡƒΡ‚Ρ‘ΠΌ Ρ€Π΅Π½Π΄Π΅Ρ€ΠΈΠ½Π³Π° ΡˆΡ€ΠΈΡ„Ρ‚Π°
  • imagefttext β€” Наносит тСкст Π½Π° ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΏΡƒΡ‚Ρ‘ΠΌ Ρ€Π΅Π½Π΄Π΅Ρ€ΠΈΠ½Π³Π° ΡˆΡ€ΠΈΡ„Ρ‚Π° Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠΎΠΉ FreeType 2
  • imagegammacorrect β€” ΠŸΡ€ΠΈΠΌΠ΅Π½ΡΠ΅Ρ‚ Π³Π°ΠΌΠΌΠ°-ΠΊΠΎΡ€Ρ€Π΅ΠΊΡ†ΠΈΡŽ ΠΊ GD-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΡŽ
  • imagegd β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ GD-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ Ρ„Π°ΠΉΠ»
  • imagegd2 β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ GD2-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ Ρ„Π°ΠΉΠ»
  • imagegetclip β€” ΠŸΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ ΠΎΡ‚ΡΠ΅ΠΊΠ°ΡŽΡ‰ΠΈΠΉ ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ
  • imagegetinterpolation β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ ΠΌΠ΅Ρ‚ΠΎΠ΄ интСрполяции
  • imagegif β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ записываСт Π² Ρ„Π°ΠΉΠ»
  • imagegrabscreen β€” Π—Π°Ρ…Π²Π°Ρ‚Ρ‹Π²Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ с экрана
  • imagegrabwindow β€” Π—Π°Ρ…Π²Π°Ρ‚Ρ‹Π²Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΎΠΊΠ½Π°
  • imageinterlace β€” Π’ΠΊΠ»ΡŽΡ‡Π°Π΅Ρ‚ ΠΈΠ»ΠΈ Π²Ρ‹ΠΊΠ»ΡŽΡ‡Π°Π΅Ρ‚ интСрлСйсинг
  • imageistruecolor β€” ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅Ρ‚, относится Π»ΠΈ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΊ изобраТСниям truecolor
  • imagejpeg β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ записываСт Π² Ρ„Π°ΠΉΠ»
  • imagelayereffect β€” УстанавливаСт Ρ„Π»Π°Π³ Π°Π»ΡŒΡ„Π°-смСшивания, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ эффСкты налоТСния ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ
  • imageline β€” РисуСт ΠΎΡ‚Ρ€Π΅Π·ΠΎΠΊ
  • imageloadfont β€” Π—Π°Π³Ρ€ΡƒΠΆΠ°Π΅Ρ‚ Π½ΠΎΠ²Ρ‹ΠΉ ΡˆΡ€ΠΈΡ„Ρ‚
  • imageopenpolygon β€” РисуСт ΠΎΡ‚ΠΊΡ€Ρ‹Ρ‚Ρ‹ΠΉ ΠΏΠΎΠ»ΠΈΠ³ΠΎΠ½
  • imagepalettecopy β€” ΠšΠΎΠΏΠΈΡ€ΡƒΠ΅Ρ‚ ΠΏΠ°Π»ΠΈΡ‚Ρ€Ρƒ ΠΈΠ· ΠΎΠ΄Π½ΠΎΠ³ΠΎ изобраТСния Π² Π΄Ρ€ΡƒΠ³ΠΎΠ΅
  • imagepalettetotruecolor β€” ΠŸΡ€Π΅ΠΎΠ±Ρ€Π°Π·ΠΎΠ²Ρ‹Π²Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π½Π° основС ΠΏΠ°Π»ΠΈΡ‚Ρ€Ρ‹ Π² настоящий Ρ†Π²Π΅Ρ‚
  • imagepng β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ PNG-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ Ρ„Π°ΠΉΠ»
  • imagepolygon β€” РисуСт ΠΌΠ½ΠΎΠ³ΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ
  • imagerectangle β€” РисуСт ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ
  • imageresolution β€” ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅Ρ‚ ΠΈΠ»ΠΈ устанавливаСт Ρ€Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΠ΅ изобраТСния
  • imagerotate β€” ΠŸΠΎΠ²ΠΎΡ€Π°Ρ‡ΠΈΠ²Π°Π΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌ ΡƒΠ³Π»ΠΎΠΌ
  • imagesavealpha β€” ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅Ρ‚, ΡΠΎΡ…Ρ€Π°Π½ΡΡ‚ΡŒ Π»ΠΈ ΠΏΠΎΠ»Π½ΡƒΡŽ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΡŽ Π°Π»ΡŒΡ„Π°-ΠΊΠ°Π½Π°Π»Π° ΠΏΡ€ΠΈ сохранСнии ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ
  • imagescale β€” ΠœΠ°ΡΡˆΡ‚Π°Π±ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΏΠΎ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ ΡˆΠΈΡ€ΠΈΠ½Π΅ ΠΈ высотС
  • imagesetbrush β€” УстанавливаСт ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ кисти для рисования Π»ΠΈΠ½ΠΈΠΉ
  • imagesetclip β€” УстанавливаСт ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ отсСчСния
  • imagesetinterpolation β€” УстанавливаСт ΠΌΠ΅Ρ‚ΠΎΠ΄ интСрполяции
  • imagesetpixel β€” РисуСт Ρ‚ΠΎΡ‡ΠΊΡƒ
  • imagesetstyle β€” УстанавливаСт ΡΡ‚ΠΈΠ»ΡŒ рисования Π»ΠΈΠ½ΠΈΠΉ
  • imagesetthickness β€” УстанавливаСт Ρ‚ΠΎΠ»Ρ‰ΠΈΠ½Ρƒ Π»ΠΈΠ½ΠΈΠΉ
  • imagesettile β€” УстанавливаСт ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΊΠ°ΠΊ элСмСнт ΠΌΠΎΠ·Π°ΠΈΡ‡Π½ΠΎΠΉ Π·Π°Π»ΠΈΠ²ΠΊΠΈ
  • imagestring β€” РисуСт строку тСкста Π³ΠΎΡ€ΠΈΠ·ΠΎΠ½Ρ‚Π°Π»ΡŒΠ½ΠΎ
  • imagestringup β€” РисуСт строку тСкста Π²Π΅Ρ€Ρ‚ΠΈΠΊΠ°Π»ΡŒΠ½ΠΎ
  • imagesx β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΡˆΠΈΡ€ΠΈΠ½Ρ‹ изобраТСния
  • imagesy β€” ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ высоты изобраТСния
  • imagetruecolortopalette β€” ΠŸΡ€Π΅ΠΎΠ±Ρ€Π°Π·ΠΎΠ²Ρ‹Π²Π°Π΅Ρ‚ truecolor-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² ΠΏΠ°Π»ΠΈΡ‚Ρ€ΠΎΠ²ΠΎΠ΅
  • imagettfbbox β€” ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅Ρ‚ Π³Ρ€Π°Π½ΠΈΡ†Ρ‹ ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΎΠ³ΠΎ обрамлСния для тСкста, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠ° freetype2 Π²Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ Π½Π° экран ΠΏΡƒΡ‚Ρ‘ΠΌ Ρ€Π΅Π½Π΄Π΅Ρ€ΠΈΠ½Π³Π° ΡˆΡ€ΠΈΡ„Ρ‚Π°
  • imagettftext β€” РисуСт тСкст Π½Π° ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΈ ΡˆΡ€ΠΈΡ„Ρ‚ΠΎΠΌ TrueType
  • imagetypes β€” Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ список Ρ‚ΠΈΠΏΠΎΠ² ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠΉ, ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°Π΅ΠΌΡ‹Ρ… PHP сборкой
  • imagewbmp β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ записываСт Π² Ρ„Π°ΠΉΠ»
  • imagewebp β€” Π’Ρ‹Π²ΠΎΠ΄ WebP-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ Ρ„Π°ΠΉΠ»
  • imagexbm β€” Π’Ρ‹Π²ΠΎΠ΄ΠΈΡ‚ XBM-ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ Π² Π±Ρ€Π°ΡƒΠ·Π΅Ρ€ ΠΈΠ»ΠΈ Π² Ρ„Π°ΠΉΠ»
  • iptcembed β€” ВстраиваниС Π΄Π²ΠΎΠΈΡ‡Π½Ρ‹Ρ… IPTC Π΄Π°Π½Π½Ρ‹Ρ… Π² JPEG ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅
  • iptcparse β€” Π Π°Π·Π±ΠΎΡ€ Π΄Π²ΠΎΠΈΡ‡Π½Ρ‹Ρ… IPTC Π΄Π°Π½Π½Ρ‹Ρ… Π½Π° ΠΎΡ‚Π΄Π΅Π»ΡŒΠ½Ρ‹Π΅ Ρ‚Π΅Π³ΠΈ
  • jpeg2wbmp β€” ΠšΠΎΠ½Π²Π΅Ρ€Ρ‚ΠΈΡ€ΡƒΠ΅Ρ‚ ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅ ΠΈΠ· Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π° JPEG Π² WBMP
  • png2wbmp β€” ΠŸΡ€Π΅ΠΎΠ±Ρ€Π°Π·ΠΎΠ²Ρ‹Π²Π°Π΅Ρ‚ PNG-Ρ„Π°ΠΉΠ»Π° Π² Ρ„Π°ΠΉΠ» WBMP
οΌ‹Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΡ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ 8 notes

up
8
chuckstudios at gmail dot com ΒΆ
17 years ago
I wrote a simple function to convert an image resource to PGM (portable graymap) in order to feed it to an OCR program. It works just like the rest of the image output functions, and will convert to grayscale for you:

<?php
    function imagepgm($image, $filename = null)
    {
        $pgm = "P5 ".imagesx($image)." ".imagesy($image)." 255\n";
        for($y = 0; $y < imagesy($image); $y++)
        {
            for($x = 0; $x < imagesx($image); $x++)
            {
                $colors = imagecolorsforindex($image, imagecolorat($image, $x, $y));
                $pgm .= chr(0.3 * $colors["red"] + 0.59 * $colors["green"] + 0.11 * $colors["blue"]);
            }
        }
        if($filename != null)
        {
            $fp = fopen($filename, "w");
            fwrite($fp, $pgm);
            fclose($fp);
        }
        else
        {
            return $pgm;
        }
    }
?>
up
5
michal-ok at o2 dot pl ΒΆ
20 years ago
The image sharpen function (by Alex R. Austin) provided below seems to be very resource hungry and I couldn't make it work on two different servers - trying to sharpen a 413 x 413 image I ended up with "Fatal error: Allowed memory size of 8388608 bytes exhausted" or "Internal Server Error" or the script terminated without notice. Because I had no priviliges to change the default memory limit on these servers I started looking for other sharpen functions. I have come across a php Unsharp Mask function which works like a charm on both of the servers I dealt with. It can be found at http://vikjavev.no/hovudsida/umtestside.php.
up
4
felipensp at gmail dot com ΒΆ
20 years ago
Representation decimal of a color in hexadecimal for use on functions of library GD.

<?php

    // Representation hexadecimal
    $var = '#FFFFFF';

    function getRgbFromGd($color_hex) {

        return array_map('hexdec', explode('|', wordwrap(substr($color_hex, 1), 2, '|', 1)));

    }
    
    print_r(getRgbFromGd($var));

    // Output: Array ( [0] => 255 [1] => 255 [2] => 255 )

?>
up
-1
shd at earthling dot net ΒΆ
20 years ago
If you happen to need a way to output a Windows BMP file (e.g. when using the PEAR ExcelWriter), feel free to use the following code:

<?php
function imagebmp ($im, $fn = false)
{
    if (!$im) return false;
            
    if ($fn === false) $fn = 'php://output';
    $f = fopen ($fn, "w");
    if (!$f) return false;
            
    //Image dimensions
    $biWidth = imagesx ($im);
    $biHeight = imagesy ($im);
    $biBPLine = $biWidth * 3;
    $biStride = ($biBPLine + 3) & ~3;
    $biSizeImage = $biStride * $biHeight;
    $bfOffBits = 54;
    $bfSize = $bfOffBits + $biSizeImage;
            
    //BITMAPFILEHEADER
    fwrite ($f, 'BM', 2);
    fwrite ($f, pack ('VvvV', $bfSize, 0, 0, $bfOffBits));
            
    //BITMAPINFO (BITMAPINFOHEADER)
    fwrite ($f, pack ('VVVvvVVVVVV', 40, $biWidth, $biHeight, 1, 24, 0, $biSizeImage, 0, 0, 0, 0));
            
    $numpad = $biStride - $biBPLine;
    for ($y = $biHeight - 1; $y >= 0; --$y)
    {
        for ($x = 0; $x < $biWidth; ++$x)
        {
            $col = imagecolorat ($im, $x, $y);
            fwrite ($f, pack ('V', $col), 3);
        }
        for ($i = 0; $i < $numpad; ++$i)
            fwrite ($f, pack ('C', 0));
    }
    fclose ($f);
    return true;
}
?>

It works the same way as regular imagejpeg/imagepng do and only supports GD2.0 true colour bitmaps (which is what's required by ExcelWriter).
up
-2
delabahan at gmail dot com ΒΆ
9 years ago
This is an example of get high resolution images.

<?php
 /**
 * Class name      : resizeImage
 * Created by   : wang
 * Description   : This class is to resize the image from original size to new size 
 */
class resizeImage
{
     /**
     * Function name : resize_img
     * Description   : This function is to resize image 
     * @param          : $origimg variable is the original image 
     * @param          : $newimg variable is the new image 
     * @param          : $w variable is the width of image 
     * @param          : $f variable is the height of image 
     */
    public  function resize_img($origimg,$newimg,$w,$h){
        $info = getimagesize($origimg);
        $mime   = $info['mime'];

        // Make sure that the requested file is actually an image
        if(substr($mime, 0, 6) != 'image/')
        {
            header('HTTP/1.1 400 Bad Request');
            return 'Error: requested file is not an accepted type: ' .$origimg;
            exit();
        }

        // Check they extention of image
        $extension = image_type_to_extension($info[2]);
        if(strtolower($extension) == '.png'){
            $img = $this->resize_imagepng($origimg,$w, $h);
            imagepng($img,$newimg);
            imagedestroy($img);
        }elseif(strtolower($extension) == '.jpeg'){
            $img = $this->resize_imagejpeg($origimg, $w, $h);
            imagejpeg($img, $newimg);
            imagedestroy($img);
        }elseif(strtolower($extension == '.gif')){
            $img = $this->resize_imagegif($origimg, $w, $h);
            imagegif($img,$newimg);
            imagedestroy($img);
        }

    }
     /**
     * End function name : resize_img
     */

     /**
     * Function name : resize_imagepng
     * Description   : This function is to resize png image 
     * @param          : $file variable is the original image 
     * @param          : $w variable is the width of image 
     * @param          : $f variable is the height of image 
     */
    private function resize_imagepng($file, $w, $h) {
       list($width, $height) = getimagesize($file);
       $src = imagecreatefrompng($file);
       $dst = imagecreatetruecolor($w, $h);
       imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $width, $height);
       return $dst;
    }
     /**
     * End function name : resize_imagepng
     */

     /**
     * Function name : resize_imagejpeg
     * Description   : This function is to resize jpeg image 
     * @param          : $file variable is the original image 
     * @param          : $w variable is the width of image 
     * @param          : $f variable is the height of image 
     */
    private function resize_imagejpeg($file, $w, $h) {
       list($width, $height) = getimagesize($file);
       $src = imagecreatefromjpeg($file);
       $dst = imagecreatetruecolor($w, $h);
       imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $width, $height);
       return $dst;
    }
     /**
     * End function name : resize_imagejpeg
     */

     /**
     * Function name : resize_imagegif
     * Description   : This function is to resize gif image 
     * @param          : $file variable is the original image 
     * @param          : $w variable is the width of image 
     * @param          : $f variable is the height of image 
     */
    private function resize_imagegif($file, $w, $h) {
       list($width, $height) = getimagesize($file);
       $src = imagecreatefromgif($file);
       $dst = imagecreatetruecolor($w, $h);
       imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $width, $height);
       return $dst;
    }
     /**
     * End function name : resize_imagegif
     */
}
/**
* End class name : resizeImage
*/
?>
up
-3
ingo at jache dot de ΒΆ
14 years ago
I know this might look somewhat superfluous to others, but i once came across a situation where i needed a *strong* blur on an image without having ImageMagick installed. Executing the convolution-filter several times on the same image is awfully slow and still doesn't give a good blur.

The function below accepts a truecolor-image and a blur-factor between 0.0 and 1.0. Beware: It's still quite slow.

<?php

    function blurImage($srcimg,$blur)
    {
        $blur = $blur*$blur;
        $blur = max(0,min(1,$blur));
    
        $srcw = imagesx($srcimg);
        $srch = imagesy($srcimg);
        
        $dstimg = imagecreatetruecolor($srcw,$srch);
    
        $f1a = $blur;
        $f1b = 1.0 - $blur;

    
        $cr = 0; $cg = 0; $cb = 0;
        $nr = 0; $ng = 0; $nb = 0;

        $rgb = imagecolorat($srcimg,0,0);
        $or = ($rgb >> 16) & 0xFF;
        $og = ($rgb >> 8) & 0xFF;
        $ob = ($rgb) & 0xFF;

        //-------------------------------------------------
        // first line is a special case
        //-------------------------------------------------
        $x = $srcw;
        $y = $srch-1;
        while ($x--)
        {
            //horizontal blurren
            $rgb = imagecolorat($srcimg,$x,$y);
            $cr = ($rgb >> 16) & 0xFF;
            $cg = ($rgb >> 8) & 0xFF;
            $cb = ($rgb) & 0xFF;
    
            $nr = ($cr * $f1a) + ($or * $f1b);
            $ng = ($cg * $f1a) + ($og * $f1b);
            $nb = ($cb * $f1a) + ($ob * $f1b);    

            $or = $nr;
            $og = $ng;
            $ob = $nb;
            
            imagesetpixel($dstimg,$x,$y,($nr << 16) | ($ng << 8) | ($nb));
        }
        //-------------------------------------------------

        //-------------------------------------------------
        // now process the entire picture
        //-------------------------------------------------
        $y = $srch-1;
        while ($y--)
        {

            $rgb = imagecolorat($srcimg,0,$y);
            $or = ($rgb >> 16) & 0xFF;
            $og = ($rgb >> 8) & 0xFF;
            $ob = ($rgb) & 0xFF;

            $x = $srcw;
            while ($x--)
            {
                //horizontal 
                $rgb = imagecolorat($srcimg,$x,$y);
                $cr = ($rgb >> 16) & 0xFF;
                $cg = ($rgb >> 8) & 0xFF;
                $cb = ($rgb) & 0xFF;
                
                $nr = ($cr * $f1a) + ($or * $f1b);
                $ng = ($cg * $f1a) + ($og * $f1b);
                $nb = ($cb * $f1a) + ($ob * $f1b);    
    
                $or = $nr;
                $og = $ng;
                $ob = $nb;
                
                
                //vertical 
                $rgb = imagecolorat($dstimg,$x,$y+1);
                $vr = ($rgb >> 16) & 0xFF;
                $vg = ($rgb >> 8) & 0xFF;
                $vb = ($rgb) & 0xFF;
                
                $nr = ($nr * $f1a) + ($vr * $f1b);
                $ng = ($ng * $f1a) + ($vg * $f1b);
                $nb = ($nb * $f1a) + ($vb * $f1b);    
    
                $vr = $nr;
                $vg = $ng;
                $vb = $nb;
                
                imagesetpixel($dstimg,$x,$y,($nr << 16) | ($ng << 8) | ($nb));
            }
        
        }
        //-------------------------------------------------
        return $dstimg;        

    }

    
    $srcimg = imagecreatefromjpeg("test.jpg");
    $dstimg = blurImage($srcimg,0.2);

    header('Content-type: image/jpeg');
    echo( imagejpeg($dstimg) );
    exit();
    
    
?>
up
-2
jeff at lushmedia dot com ΒΆ
22 years ago
I wrote an online overview of the image functions that people might find useful. In addition to a general overview of the various function categories and code samples, I have included many interactive examples of the functions, allowing viewers to experiment with the parameters, and seeing the results in real time. The presentation is located at New York PHP
http://www.nyphp.org/content/presentations/GDintro/
up
-4
mpyw ΒΆ
9 years ago
This is an example of black-and-white imagebmp() implementation. 

<?php

/**
 * Output a black-and-white BMP image to either the browser or a file.
 * 
 * @param resource $image
 *            An image resource, returned by one of the image creation functions,
 *            such as imagecreatetruecolor().
 *
 * @param string|null $to
 *            The path or an open stream resource
 *            (which is automatically being closed after this function returns)
 *            to save the file to.
 *            If not set or NULL, the raw image stream will be outputted directly.
 *
 * @param float $threshold
 *            The number in the range of 0.0 to 1.0.
 *            Brighter for larger, or darker for smaller.
 *
 * @return bool Returns TRUE on success or FALSE on failure.
 * 
 */
function imagebwbmp($image, $to = null, $threshold = 0.5)
{
    if (func_num_args() < 1) {
        $fmt = "imagebwbmp() expects a least 1 parameters, %d given";
        trigger_error(sprintf($fmt, func_num_args()), E_USER_WARNING);
        return;
    }
    if (!is_resource($image)) {
        $fmt = "imagebwbmp() expects parameter 1 to be resource, %s given";
        trigger_error(sprintf($fmt, gettype($image)), E_USER_WARNING);
        return;
    }
    if (!is_numeric($threshold)) {
        $fmt = "imagebwbmp() expects parameter 3 to be float, %s given";
        trigger_error(sprintf($fmt, gettype($threshold)), E_USER_WARNING);
        return;
    }

    if (get_resource_type($image) !== 'gd') {
        $msg = "imagebwbmp(): supplied resource is not a valid gd resource";
        trigger_error($msg, E_USER_WARNING);
        return false;
    }
    switch (true) {
        case $to === null:
            break;
        case is_resource($to) && get_resource_type($to) === 'stream':
        case is_string($to) && $to = fopen($to, 'wb'):
            if (preg_match('/[waxc+]/', stream_get_meta_data($to)['mode'])) {
                break;
            }
        default:
            $msg = "imagebwbmp(): Invalid 2nd parameter, it must a writable filename or a writable stream";
            trigger_error($msg, E_USER_WARNING);
            return false;
    }

    if ($to === null) {
        $to = fopen('php://output', 'wb');
    }

    $biWidth = imagesx($image);
    $biHeight = imagesy($image);
    $biSizeImage = ((int)ceil($biWidth / 32) * 32 / 8 * $biHeight);
    $bfOffBits = 54 + 4 * 2; // Use two colors (black and white)
    $bfSize = $bfOffBits + $biSizeImage;
    
    fwrite($to, 'BM');
    fwrite($to, pack('VvvV', $bfSize, 0, 0, $bfOffBits));
    fwrite($to, pack('VVVvvVVVVVV', 40, $biWidth, $biHeight, 1, 1, 0, $biSizeImage, 0, 0, 0, 0));
    fwrite($to, "\xff\xff\xff\x00"); // white
    fwrite($to, "\x00\x00\x00\x00"); // black
    
    for ($y = $biHeight - 1; $y >= 0; --$y) {
        $byte = 0;
        for ($x = 0; $x < $biWidth; ++$x) {
            $rgb = imagecolorsforindex($image, imagecolorat($image, $x, $y));
            $value = (0.299 * $rgb['red'] + 0.587 * $rgb['green'] + 0.114 * $rgb['blue']) / 0xff;
            $color = (int)($value > $threshold);
            $byte = ($byte << 1) | $color;
            if ($x % 8 === 7) {
                fwrite($to, pack('C', $byte));
                $byte = 0;
            }
        }
        if ($x % 8) {
            fwrite($to, pack('C', $byte << (8 - $x % 8)));
        }
        if ($x % 32) {
            fwrite($to, str_repeat("\x00", (int)((32 - $x % 32) / 8)));
        }
    }

    return true;
}
?>