Thumbnails an image to the requested size.
There are two levels of failover for this service now:
more
Thumbnails an image to the requested size.
- Supported image formats are PNG, JPG, and GIF.
- If no parameters are provided the parameters default to 75x75 in fit mode.
- If maxheight=0 and maxwidth=0, the original image is returned.
- If maxheight=0 or maxwidth=0 and the other is set to a legitimate value, the 0 value is discarded and the image is scaled such that the returned dimension matches the specified dimension.
- If the desired dimensions are greater than the original image, the original image will be returned.
- The service doesn't support zooming.
- The service will only process images whose original size is less than 36 million pixels.
The service operates in several modes:
- fit
- In fit mode, given a rectangle, the image will be resized to fit in the rectangle. There may be empty space left over along one dimension. Scaling is done using the smaller scale value, i.e. the smaller of dw/w and dh/h is used to scale both dimensions.
- fill
- In fill mode, given a rectangle, the image will be resized so that the rectangle fits completely inside the resulting image and one of the image dimensions is the same as one of the provided rectangle's. Scaling is done using the larger scale value i.e. the larger of dw/w and dh/h is used to scale both dimensions. The practical outcome is that the dimension (of the provided rectangle) nearest to the actual dimension will be resized to be exactly the matching rectangle dimension.
- fillcrop
- In this mode, a fill operation is done and any part of the image that protrudes out of the provided rectangle is cropped out. Both horizontal and vertical dimensions are required, and must be non-zero positive integers.
- fillcropmid
- In this mode, a fill operation is done, the crop rectangle is centered on the resulting image and any part of that image that protrudes out of the centered rectangle is cropped out. Center is calculated by: (image.x - crop.x)/2, and y is 0. Both horizontal and vertical dimensions are required, and must be non-zero positive integers.
There are two levels of failover for this service now:
- If thumb-nailing fails because image is too large and the onfail argument is provided, service redirects to URL provided.
- If no onfail argument is provided, it will thumbnail a default image and send that back.
- If default image is not found, returns a 413 (sec. 10.4.14)
Example: Wide Images
1. Original:
http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f800000000514e28e
2. Only maxwidth
http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f800000000514e28e?maxwidth=100
3. maxwidth and maxheight
http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f800000000514e28e?maxwidth=100&maxheight=100
4. No arguments
http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f800000000514e28e
Example: Tall Images
1. Original
http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f8000000004972c6e
2. Only maxwidth
http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000004972c6e?maxwidth=100
3. maxwidth and maxheight
http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000004972c6e?maxwidth=100&maxheight=100
4. No arguments
http://www.freebase.com/api/trans/image_thumb/guid/9202a8c04000641f8000000004972c6e
Extra arguments ignored:
- Yes
Accessible via:
- /api/trans/image_thumb
Permits HTTP GET:
- Yes