Tuesday, November 19, 2024
Google search engine
HomeLanguagesPHP | Imagick queryFormats() Function

PHP | Imagick queryFormats() Function

The Imagick::queryFormats() function is an inbuilt function in PHP which is used to get the formats supported by Imagick.

Syntax:

array Imagick::queryFormats( string $pattern = "*" )

Parameters: This function accepts a single parameter $pattern which holds the pattern to be matched with formats.

Return Value: This function returns an array containing the formats supported by Imagick.

Exceptions: This function throws ImagickException on error.

Below given programs illustrate the Imagick::queryFormats() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagick = new Imagick();
  
// Get all the formats
$formats $imagick->queryFormats('*');
print("<pre>".print_r($formats, true)."</pre>");
?>


Output:

Array
(
    [0] => 3FR
    [1] => AAI
    [2] => AI
    [3] => ART
    [4] => ARW
    [5] => AVI
    [6] => AVS
    [7] => BGR
    [8] => BGRA
    [9] => BGRO
    [10] => BIE
    [11] => BMP
    [12] => BMP2
    [13] => BMP3
    [14] => BRF
    [15] => CAL
    [16] => CALS
    [17] => CANVAS
    [18] => CAPTION
    [19] => CIN
    [20] => CIP
    [21] => CLIP
    [22] => CMYK
    [23] => CMYKA
    [24] => CR2
    [25] => CRW
    [26] => CUR
    [27] => CUT
    [28] => DATA
    [29] => DCM
    [30] => DCR
    [31] => DCX
    [32] => DDS
    [33] => DFONT
    [34] => DJVU
    [35] => DNG
    [36] => DOT
    [37] => DPX
    [38] => DXT1
    [39] => DXT5
    [40] => EPDF
    [41] => EPI
    [42] => EPS
    [43] => EPS2
    [44] => EPS3
    [45] => EPSF
    [46] => EPSI
    [47] => EPT
    [48] => EPT2
    [49] => EPT3
    [50] => ERF
    [51] => EXR
    [52] => FAX
    [53] => FILE
    [54] => FITS
    [55] => FRACTAL
    [56] => FTP
    [57] => FTS
    [58] => G3
    [59] => G4
    [60] => GIF
    [61] => GIF87
    [62] => GRADIENT
    [63] => GRAY
    [64] => GROUP4
    [65] => GV
    [66] => H
    [67] => HALD
    [68] => HDR
    [69] => HISTOGRAM
    [70] => HRZ
    [71] => HTM
    [72] => HTML
    [73] => HTTP
    [74] => HTTPS
    [75] => ICB
    [76] => ICO
    [77] => ICON
    [78] => IIQ
    [79] => INFO
    [80] => INLINE
    [81] => IPL
    [82] => ISOBRL
    [83] => ISOBRL6
    [84] => JBG
    [85] => JBIG
    [86] => JNG
    [87] => JNX
    [88] => JPE
    [89] => JPEG
    [90] => JPG
    [91] => JPS
    [92] => JSON
    [93] => K25
    [94] => KDC
    [95] => LABEL
    [96] => M2V
    [97] => M4V
    [98] => MAC
    [99] => MAGICK
    [100] => MAP
    [101] => MASK
    [102] => MAT
    [103] => MATTE
    [104] => MEF
    [105] => MIFF
    [106] => MKV
    [107] => MNG
    [108] => MONO
    [109] => MOV
    [110] => MP4
    [111] => MPC
    [112] => MPEG
    [113] => MPG
    [114] => MRW
    [115] => MSL
    [116] => MSVG
    [117] => MTV
    [118] => MVG
    [119] => NEF
    [120] => NRW
    [121] => NULL
    [122] => ORF
    [123] => OTB
    [124] => OTF
    [125] => PAL
    [126] => PALM
    [127] => PAM
    [128] => PANGO
    [129] => PATTERN
    [130] => PBM
    [131] => PCD
    [132] => PCDS
    [133] => PCL
    [134] => PCT
    [135] => PCX
    [136] => PDB
    [137] => PDF
    [138] => PDFA
    [139] => PEF
    [140] => PES
    [141] => PFA
    [142] => PFB
    [143] => PFM
    [144] => PGM
    [145] => PICON
    [146] => PICT
    [147] => PIX
    [148] => PJPEG
    [149] => PLASMA
    [150] => PNG
    [151] => PNG00
    [152] => PNG24
    [153] => PNG32
    [154] => PNG48
    [155] => PNG64
    [156] => PNG8
    [157] => PNM
    [158] => PPM
    [159] => PREVIEW
    [160] => PS
    [161] => PS2
    [162] => PS3
    [163] => PSB
    [164] => PSD
    [165] => PTIF
    [166] => PWP
    [167] => RADIAL-GRADIENT
    [168] => RAF
    [169] => RAS
    [170] => RAW
    [171] => RGB
    [172] => RGBA
    [173] => RGBO
    [174] => RGF
    [175] => RLA
    [176] => RLE
    [177] => RMF
    [178] => RW2
    [179] => SCR
    [180] => SCT
    [181] => SFW
    [182] => SGI
    [183] => SHTML
    [184] => SIX
    [185] => SIXEL
    [186] => SPARSE-COLOR
    [187] => SR2
    [188] => SRF
    [189] => STEGANO
    [190] => SUN
    [191] => SVG
    [192] => SVGZ
    [193] => TEXT
    [194] => TGA
    [195] => THUMBNAIL
    [196] => TIFF
    [197] => TIFF64
    [198] => TILE
    [199] => TIM
    [200] => TTC
    [201] => TTF
    [202] => TXT
    [203] => UBRL
    [204] => UBRL6
    [205] => UIL
    [206] => UYVY
    [207] => VDA
    [208] => VICAR
    [209] => VID
    [210] => VIFF
    [211] => VIPS
    [212] => VST
    [213] => WBMP
    [214] => WMF
    [215] => WMV
    [216] => WMZ
    [217] => WPG
    [218] => X
    [219] => X3F
    [220] => XBM
    [221] => XC
    [222] => XCF
    [223] => XPM
    [224] => XPS
    [225] => XV
    [226] => XWD
    [227] => YCbCr
    [228] => YCbCrA
    [229] => YUV
)

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick();
  
// Get all the formats with pattern related to 'PNG'
$formats $imagick->queryFormats('PNG*');
print("<pre>".print_r($formats, true)."</pre>");
?>


Output:

Array
(
    [0] => PNG
    [1] => PNG00
    [2] => PNG24
    [3] => PNG32
    [4] => PNG48
    [5] => PNG64
    [6] => PNG8
)

Reference: https://www.php.net/manual/en/imagick.queryformats.php

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments