To flip a image in CSS you can use the following snippet.
img { -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -ms-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); filter: FlipH; -ms-filter: "FlipH"; }
To flip a image in CSS you can use the following snippet.
img { -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -ms-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); filter: FlipH; -ms-filter: "FlipH"; }
To set the ios bookmark icon in HTML you can use the following snippet.
<link rel="apple-touch-icon" href="iOs_Icon.png"/>
If your icon is already glossy, you can prevent the device from adding its own gloss by using.
<link rel="apple-touch-icon-precomposed" href="iOs_Icon.png"/>
To rotate a image in C# and VB.NET you can use the following snippet.
public enum RotateMode { Ninetee = 0, OneHundretEighty = 1, TwoHundredSeventy = 2, } public static Image RotateImage(Image myImage, RotateMode myRotatemode) { var ret = myImage; switch (myRotatemode) { case RotateMode.Ninetee: ret.RotateFlip(RotateFlipType.Rotate90FlipNone); break; case RotateMode.OneHundretEighty: ret.RotateFlip(RotateFlipType.Rotate180FlipNone); break; case RotateMode.TwoHundredSeventy: ret.RotateFlip(RotateFlipType.Rotate270FlipNone); break; } return ret; }
Public Enum RotateMode Ninetee = 0 OneHundretEighty = 1 TwoHundredSeventy = 2 End Enum Public Shared Function RotateImage(myImage As Image, myRotatemode As RotateMode) As Image Dim ret = myImage Select Case myRotatemode Case RotateMode.Ninetee ret.RotateFlip(RotateFlipType.Rotate90FlipNone) Exit Select Case RotateMode.OneHundretEighty ret.RotateFlip(RotateFlipType.Rotate180FlipNone) Exit Select Case RotateMode.TwoHundredSeventy ret.RotateFlip(RotateFlipType.Rotate270FlipNone) Exit Select End Select Return ret End Function
To flip a image in C# and VB.NET you can use the following snippet.
public enum FlipMode { Horizontal = 0, Vertical = 1, Both = 2 } public Image FlipImage(Image myImage, FlipMode myFlipmode) { var ret = myImage; switch (myFlipmode) { case FlipMode.Horizontal: ret.RotateFlip(RotateFlipType.RotateNoneFlipX); break; case FlipMode.Vertical: ret.RotateFlip(RotateFlipType.RotateNoneFlipY); break; case FlipMode.Both: ret.RotateFlip(RotateFlipType.RotateNoneFlipXY); break; } return ret; }
Public Enum FlipMode Horizontal = 0 Vertical = 1 Both = 2 End Enum Public Function FlipImage(myImage As Image, myFlipmode As FlipMode) As Image Dim ret = myImage Select Case myFlipmode Case FlipMode.Horizontal ret.RotateFlip(RotateFlipType.RotateNoneFlipX) Exit Select Case FlipMode.Vertical ret.RotateFlip(RotateFlipType.RotateNoneFlipY) Exit Select Case FlipMode.Both ret.RotateFlip(RotateFlipType.RotateNoneFlipXY) Exit Select End Select Return ret End Function
To load image from web asynchron into picturebox in C# and VB.NET you can use the following snippet.
pictureBox1.WaitOnLoad = false; pictureBox1.LoadAsync(@"https://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg");
pictureBox1.WaitOnLoad = False pictureBox1.LoadAsync("https://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg")
To convert a bitmap to icon in C# and VB.NET you can use the following extension method.
public static Icon ToIcon(this Bitmap img, bool makeTransparent, Color colorToMakeTransparent) { if (makeTransparent) { img.MakeTransparent(colorToMakeTransparent); } var iconHandle = img.GetHicon(); return Icon.FromHandle(iconHandle); }
<System.Runtime.CompilerServices.Extension> _ Public Shared Function ToIcon(img As Bitmap, makeTransparent As Boolean, colorToMakeTransparent As Color) As Icon If makeTransparent Then img.MakeTransparent(colorToMakeTransparent) End If Dim iconHandle = img.GetHicon() Return Icon.FromHandle(iconHandle) End Function
To resize a image using C# or VB.NET you can use the following snippet.
public static Image ResizeImage(Image img, int width, int height) { var newImage = new Bitmap(width, height); using (var gr = Graphics.FromImage(newImage)) { gr.SmoothingMode = SmoothingMode.HighQuality; gr.InterpolationMode = InterpolationMode.HighQualityBicubic; gr.PixelOffsetMode = PixelOffsetMode.HighQuality; gr.DrawImage(img, new Rectangle(0, 0, width, height)); } return newImage; } public static Image ResizeImage(Image img, Size size) { return ResizeImage(img, size.Width, size.Height); } public static Image ResizeImage(Bitmap bmp, int width, int height) { return ResizeImage((Image)bmp, width, height); } public static Image ResizeImage(Bitmap bmp, Size size) { return ResizeImage((Image)bmp, size.Width, size.Height); }
Public Shared Function ResizeImage(img As Image, width As Integer, height As Integer) As Image Dim newImage = New Bitmap(width, height) Using gr = Graphics.FromImage(newImage) gr.SmoothingMode = SmoothingMode.HighQuality gr.InterpolationMode = InterpolationMode.HighQualityBicubic gr.PixelOffsetMode = PixelOffsetMode.HighQuality gr.DrawImage(img, New Rectangle(0, 0, width, height)) End Using Return newImage End Function Public Shared Function ResizeImage(img As Image, size As Size) As Image Return ResizeImage(img, size.Width, size.Height) End Function Public Shared Function ResizeImage(bmp As Bitmap, width As Integer, height As Integer) As Image Return ResizeImage(DirectCast(bmp, Image), width, height) End Function Public Shared Function ResizeImage(bmp As Bitmap, size As Size) As Image Return ResizeImage(DirectCast(bmp, Image), size.Width, size.Height) End Function
Here are the same methods as Extensions Methods
public static Image ResizeImage(this Image img, int width, int height) { var newImage = new Bitmap(width, height); using (var gr = Graphics.FromImage(newImage)) { gr.SmoothingMode = SmoothingMode.HighQuality; gr.InterpolationMode = InterpolationMode.HighQualityBicubic; gr.PixelOffsetMode = PixelOffsetMode.HighQuality; gr.DrawImage(img, new Rectangle(0, 0, width, height)); } return newImage; } public static Image ResizeImage(this Image img, Size size) { return ResizeImage(img, size.Width, size.Height); } public static Image ResizeImage(this Bitmap bmp, int width, int height) { return ResizeImage((Image)bmp, width, height); } public static Image ResizeImage(this Bitmap bmp, Size size) { return ResizeImage((Image)bmp, size.Width, size.Height); }
<System.Runtime.CompilerServices.Extension> _ Public Shared Function ResizeImage(img As Image, width As Integer, height As Integer) As Image Dim newImage = New Bitmap(width, height) Using gr = Graphics.FromImage(newImage) gr.SmoothingMode = SmoothingMode.HighQuality gr.InterpolationMode = InterpolationMode.HighQualityBicubic gr.PixelOffsetMode = PixelOffsetMode.HighQuality gr.DrawImage(img, New Rectangle(0, 0, width, height)) End Using Return newImage End Function <System.Runtime.CompilerServices.Extension> _ Public Shared Function ResizeImage(img As Image, size As Size) As Image Return ResizeImage(img, size.Width, size.Height) End Function <System.Runtime.CompilerServices.Extension> _ Public Shared Function ResizeImage(bmp As Bitmap, width As Integer, height As Integer) As Image Return ResizeImage(DirectCast(bmp, Image), width, height) End Function <System.Runtime.CompilerServices.Extension> _ Public Shared Function ResizeImage(bmp As Bitmap, size As Size) As Image Return ResizeImage(DirectCast(bmp, Image), size.Width, size.Height) End Function