How to add padding to an image?

Follow

Comments

4 comments

  • Avatar
    Seth Hamilton

    Focus and pad? I have a customer with 10's of thousands of pictures of shoes. All their newer stuff is nicely centered, but their older images are often pushed to the bottom. Could one use one of the fancy built in or add-on focusing tools to center on the shoe and pad it (all shoes are conveniently on white!) ?

     

  • Avatar
    Itay Taragano

    Hi Seth.

    A possible solution is to first crop the image and then add the required padding. Cropping the image can be either done by using the trim parameter as explained here.

    Another option is to use our Imagga add-on to do the cropping and then add the required padding.

    If this doesn't work for you, can you please share an example image (pushed to the bottom) and the required result, so we'll be able to offer a solution?

    If privacy is an issue, you can always open a ticket and share your images there.

  • Avatar
    Seth Hamilton

    Hi Itay,

    Can you set the pad color? My application is email, the customer has lots of photos, I currently resize limit to make them the correct size, but padding definitely provides some layout advantages. The customer defines the layout of the email and sometimes the background color isn't white.

  • Avatar
    Itay Taragano

    Hi Seth,

    You can set the background parameter ( b in URLs), which works for both color names:

    http://res.cloudinary.com/demo/image/upload/w_300,h_200,c_pad,b_blue/couple.jpg

    or RGB code:

    http://res.cloudinary.com/demo/image/upload/w_300,h_200,c_pad,b_rgb:007886/couple.jpg



    Alternatively, you can have transparent padding simply by delivering the image as PNG:

    http://res.cloudinary.com/demo/image/upload/w_300,h_200,c_pad/couple.png

Please sign in to leave a comment.