Docs | imagemash.io
DashboardSign up for Free
  • 🎉imagemash.io
  • 🚀Getting Started
    • Simple CDN Link Usage
  • 💽Sources
    • IM Cloud Storage
    • Image URL
    • Storage Providers
      • Amazon S3
      • Google Cloud
      • S3 Compatible Storage
    • Web Folder
  • 🖼️Image Transform
    • Transform Options
      • Quality
      • Width
      • Height
      • Scale
      • Crop
      • Gravity
      • Background
      • Border
      • Round
      • Output Format
      • Angle (Rotate)
      • Flip
      • Helpers
        • x, y
      • Filters
        • Tint
        • Flatten
        • Grayscale
        • Blur
        • Sharpen
        • Median
        • Threshold
        • Negative
    • Transform Cheat Sheet
    • Named Transforms
  • 🛠️API
    • API - Good to knows
    • API Methods
      • Account
        • Named Transforms
          • Get named transforms
          • Add named transform
          • Remove named transform
        • Image URL Restriction
          • Get keyword list
          • Add keyword to list
          • Remove keyword from list
          • Change keyword list usage
      • Storage
        • Upload file
        • Get and search files
        • Delete files
        • Add new tags to files
        • Set tags of files
        • Remove tags from files
        • Purge Cache
      • Optimize / Transform
  • ❓How it works?
    • Custom Domain
    • Bandwidth
    • Cloud Storage
    • Caching
    • Purge Cache
    • Limits
  • Contact Us
Powered by GitBook
On this page
  • Locational
  • Face / Faces / Object Detection
  1. Image Transform
  2. Transform Options

Gravity

gravity - g - g_<position value>

PreviousCropNextBackground

Last updated 2 years ago

Value
Type
Description

gravity value

string

Default Value: center

Value can be;

  • t, tl, tr, b, bl, br, c, center

  • face

  • faces (for multiple faces)

  • <objectname> (simple object name)

Creates a region to focus for. Every value of Gravity defines a region to focus on. In order for to Gravity parameter to work, the image must also have a parameter (by default is used).

Locational

Uses locations to adjust the gravity of cropped images.

Top: t

Top-Left: tl

Top-Right: tr

Bottom: b

Bottom-Left: bl

Bottom-Right: br

Center: center, c

Face / Faces / Object Detection

AI-powered face and object detection. Creates a region to focus on faces or objects.

Original image

https://demo.imagemash.io/woman.jpg

https://demo.imagemash.io/w_300,h_300/woman.jpg

Default position after cropping (Centered)

Please note that when you provide both Height and Width, c_cover is automatically inserted into your image. Since it is the default Crop type. You need to specify your Crop type if you need to use other types.

So the above example is actually: w_300,h_300,c_contain

https://demo.imagemash.io/g_face,w_300,h_300/woman.jpg

g_face tries to focus on the face as much as possible while trying to show you most of the image.

https://demo.imagemash.io/c_thumb,g_face,w_300,h_300/woman.jpg

Example of creating a nice portrait from an image.

https://demo.imagemash.io/c_thumb,g_face,w_300,h_450/woman.jpg

https://demo.imagemash.io/c_crop,g_face,w_200,h_200/couple.jpg

Use g_faces to focus on multiple faces.

https://demo.imagemash.io/c_crop,g_faces,w_200,h_200/couple.jpg

Enlarge the view by setting its width and height to larger values. faces will be the center point of your image as much as possible.

https://demo.imagemash.io/c_crop,g_faces,w_500,h_500/couple.jpg

As with all other Gravity values, g_<objectname> also creates a region to focus on.

Provide a simple object name.

Use the plural of an object if you want to focus on multiples of objects. Eg. chairs, sheeps, ...

If you don't provide height and width while using c_crop or c_thumb, the returned image will be the exact size of the detected object.

https://demo.imagemash.io/c_crop,g_microwave/kitchen.jpg

https://demo.imagemash.io/c_crop,g_chair/kitchen.jpg

https://demo.imagemash.io/c_crop,g_chairs/kitchen.jpg

https://demo.imagemash.io/c_crop,g_pot/kitchen.jpg

Eg. g_tr, g_face, g_sheep, g_hairdrier Required Parameters:

woman.jpg
w_300,h_300
g_face,w_300,h_300

Example usage of + g_face.

c_thumb,g_face,w_300,h_300
c_thumb,g_face,w_300,h_450
(Original)

You can also use . Since c_crop needs a region to crop, g_face provides that region. If you are going to make thumbnails, we suggest you use instead of c_crop. As it is specifically designed for that purpose.

c_crop,g_face,w_200,h_200
c_crop,g_faces,w_200,h_200
c_crop,g_faces,w_500,h_500
c,crop,g_microwave
c_crop,g_chair
c_crop,g_chairs
c_crop,g_pot
🖼️
crop
c_thumb
c_crop
c_thumb
Crop
https://demo.imagemash.io/w_400,h_150,g_t/jeep.png
c_cover
https://demo.imagemash.io/w_400,h_150,g_t/jeep.png
https://demo.imagemash.io/couple.jpg
https://demo.imagemash.io/kitchen.jpg