Dear C# experts,
Resizing image with aspect-ratio maintained and padded with image reflection on sides.
Please refer to the attachments.
"[login to view URL]" is the input.
With the following code, the resized output image is "[login to view URL]"
int width = 192; int height = 192;
Bitmap outbmp = new Bitmap(width, height);
//Bitmap inpbmp = new Bitmap(source);
using (Graphics gfx = [login to view URL](outbmp))
{
using (SolidBrush brush = new SolidBrush([login to view URL]))
{
[login to view URL](brush, 0, 0, width, height);
}
float scale = [login to view URL]((float)width / (float)[login to view URL], (float)height / (float)[login to view URL]);
var scaleWidth = (int)([login to view URL] * scale);
var scaleHeight = (int)([login to view URL] * scale);
[login to view URL](source, ((int)width - scaleWidth) / 2, ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight);
}
You can see the image is resized and placed in the middle. But there is black padding on both sides. Instead of the black padding on the both side of the image, I want the same image to be reflected. For extra clarity on the reflecting, please refer to the this image "[login to view URL]"
The expected image is shown in this image "[login to view URL]"
Least computation requirements with fast execution time is also expected from your code.
Happy Bidding. If you need further clarification, please let me know.
Hello
I have almost 9 years of experience with C#, Windows Forms and Microsoft .NET Framework.
Also, I have extensive experience with image manipulation, including resizing, rotation and Bicubic interpolation
$25 USD in 1 day
4.9 (611 reviews)
7.1
7.1
3 freelancers are bidding on average $33 USD for this job
We have gone through the requirements that you have mentioned and we will help you in this.
Message us for further discussion.
Feel Free to contact us.
Thank you!