Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Add border to image

$
0
0
What is the proper technique to add a border to an image. I've wrestled with this for days, and no matter what I try, MagikNet messes with my image. I end up with it either skewed, distorted, converted to CMYK, or some other funky conversion.

My situation is this:
A user uploads a picture to my website, but it must be certain dimensions (to fit in a frame).
If they upload one that is not right, I simply want to add white border, then center the picture within the white border. The border require vertical, horizontal, or both centering. This would seem it should be very easy to do. But no matter what I do, the resulting image is garbled in some way.

Right now I have it close. But it keeps converting it to CMYK. Then if I convert it back to RGB, the colors get hosed up.

I would post my code here, but the efforts I have gone through to make this work have become comical, and the code is ridiculous. But the 30 second version, is that I create a white image of the correct size, and drop my uploaded image into it with a 'composite' function. That should work, but the colors always get messed up when I do it.

I would rather have someone just say 'here is how you add a white border, and center the image within the border'.

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>