Photon API – WordPress Image CDN

Photon API | Developer Resources.

GET query arguments for modifying images with Photon. Also see Photon for more information.Photon is only allowed to be used by sites hosted on, or on Jetpack-connected WordPress sites. If you move to another platform, or disconnect Jetpack from your site, please also switch to another magic image service. 


esource Description
GET?w= Set the width of an image. Defaults to pixels, supports percentages.

GET?h= Set the height of an image. Defaults to pixels, supports percentages.

GET?crop=x,y,w,h Crop an image by percentages x-offset,y-offset,width,height (x,y,w,h). Percentages are used so that you don’t need to recalculate the cropping when transforming the image in other ways such as resizing it.Original image: 4-MCM_0830-1600×1064.jpgcrop=12,25,60,60 takes a 60% by 60% rectangle from the source image starting at 12% offset from the left and 25% offset from the top.,25,60,60

crop=160px,160px,788px,788px takes a 788 by 788 square starting at 160 by 160.,160px,788px,788px

crop=160px,25,1400px,60 shows you can also mix the parameters types, for example a 1400 pixels by 60% rectangle from the image starting at 160 pixels by 25%.,25,1400px,60

GET?resize= Resize and crop an image to exact width,height pixel dimensions. Set the first number as close to the target size as possible and then crop the rest. Which direction it’s resized and cropped depends on the aspect ratios of the original image and the target size.,220,400

This is useful for taking an image of any size and making it fit into a certain location while losing as little of the image as possible.

GET?fit= Fit an image to a containing box of width,height dimensions. Image aspect ratio is maintained.,300,300

For example, fit=100,100 on a landscape image with dimensions 400×300 will result in an image that is 100×75, while fit=100,100 on a portrait image with dimensions 300×400 will result in an image that is 75×100.

GET?ulb= Remove black letterboxing effect from images with ulb. This function takes only one argument,true.

Original image


GET?filter= The filter GET parameter is optional and is used to apply one of multiple filters. Valid values are: negate, grayscale, sepia, edgedetect, emboss, blurgaussian, blurselective, meanremoval.

Original image









GET?brightness= Adjust the brightness of an image. Valid values are -255 through 255 where -255 is black and 255 is white. Higher is brighter. The default is zero.brightness=-40 will darken an image by 40 and brightness=80will brighten an image by 80.




GET?contrast= Adjust the contrast contrast of an image. Valid values are -100 through 100. The default is zero.contrast=-50 will decrease contrast by 50 and contrast=50 will increase contrast by 50.




GET?colorize= Add color hues to an image with colorizeby passing a comma separated list of red,green,blue (RGB) values such as 255,0,0 (red), 0,255,0 (green), 0,0,255 (blue).,0,0,100,0,0,100




GET?smooth= The smoothparameter can be used to smooth out the image.

Original image


From the comments area of the PHP manual on the function: “Applies a 9-cell convolution matrix where center pixel has the weight arg1 and others weight of 1.0. The result is normalized by dividing the sum with arg1 + 8.0 (sum of the matrix). Any float is accepted, large value (in practice: 2048 or more) = no change”. Simply put, 0 appears to be maximum smoothing with higher numbers being less smoothing.

GET?zoom= Use zoomto size images for high pixel ratio devices and browsers when zoomed. Not available to use with crop. Zoom is intended for use by scripts such as devicepx.js which automatically set the zoom level. Valid zoom levels are 1,1.5,2-10.

Original image





This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s