[Tech]Creating thumbnails of an Image in just a single Line...
System.Drawing.Image.FromFile _ ("c:\MyPicture.png").GetThumbnailImage _ (150, 150, Nothing, System.IntPtr.Zero).Save _ ("C:\Thumbnail.gif", System.Drawing.Imaging.ImageFormat.Gif)OK, that's not one Physical Line, but it is one Logical Line, so that 1 Line Claim still holds:D OK, let's see what we're doing here... First up, we are using the
FromFilestatic Method of the
System.Drawing.Imageclass to load an Image from disk and return an
ImageObject, with which we immediately call
GetThumbnailImage, with the width and height of the Thumbnail, along with a dubious
Nullfor C#ers] and a Zero Pointer. I donno why they are there, but the docs said that though they weren't used, they had to be there. Donno why. Poor Framework Design:P Anyway, the
GetThumbnailImagecall returns yet another
Imageobject, on which we call the
SaveMethod with the File Name and the Image Format of the Thumbnail file. Intristically, .NET supports 10 Image Formats. List of them found here BTW, I made the Code a bit Unreadable using line continuation, inorder for that 1 line Title:D Sorry about that. And, Where are the comments ?