You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
I'm trying to create thumbnails from an image and draw a border around it. But I lack the knowledge to do that.
I need to create an image with different dimensions, for example 128x128px with border 1,2 or 4 pixels and in the remaining inner area to put the resized original, cropped image.
So if the border is 4 pixels I have to resize and crop my original image to 120 x 120 (8px from 4+4 from the border) and center it inside the new one.
I have to keep the original image for few other uses.
In addition if the picture is not a square, I have to crop it.
Right now I'm using this code to resize and crop the image:
var newImage = image.Clone(i => i.Resize(new ResizeOptions() { Mode = ResizeMode.Crop, Position = AnchorPositionMode.Center, Size = new Size(width, height) }));
With this code I get the thumbnail, but I don't know how to do the border.
I was thinking for something like creating blank, white image(like canvas) with the desired size and insert in it the cropped picture from the above code in its center.
Can you give me tips how to do that, what should I use?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi.
I'm trying to create thumbnails from an image and draw a border around it. But I lack the knowledge to do that.
I need to create an image with different dimensions, for example 128x128px with border 1,2 or 4 pixels and in the remaining inner area to put the resized original, cropped image.
So if the border is 4 pixels I have to resize and crop my original image to 120 x 120 (8px from 4+4 from the border) and center it inside the new one.
I have to keep the original image for few other uses.
In addition if the picture is not a square, I have to crop it.
Right now I'm using this code to resize and crop the image:
var newImage = image.Clone(i => i.Resize(new ResizeOptions() { Mode = ResizeMode.Crop, Position = AnchorPositionMode.Center, Size = new Size(width, height) }));
With this code I get the thumbnail, but I don't know how to do the border.
I was thinking for something like creating blank, white image(like canvas) with the desired size and insert in it the cropped picture from the above code in its center.
Can you give me tips how to do that, what should I use?
Beta Was this translation helpful? Give feedback.
All reactions