I am developing a service in which users can upload images and save them to a library. I want to preserve (so that people can upload high resolution images), but also use a thumbnail image as a copy of the image.
I have the problem that the thumbnail "weight" is too much more than the original file, proportionally when I check the basic properties of each file (XNV), I can see that the original Files are saved with 32 bits per aircraft, while in the source file, for example, only 24 bits per aircraft.
What is the correct way to copy the original file using compression still? It is a part of the code:
Private Zero ResizeImage (String BasicFile, String Newfile, Inc. Nudity, Ink MaxHight, Boole Only Resize Effect, String Directory) {System.Drawing.Image FullsizeImage = System Drawing.Image.FromFile (originalFile); // Prevent the use of internal thumbnail images. FullsizeImage.RotateFlip (System.Drawing.RotateFlipType.Rotate180FlipNone); FullsizeImage.RotateFlip (System.Drawing.RotateFlipType.Rotate180FlipNone); If (Resize Effect Only) {If (fullscreen width & lt; = NewWidth) {NewWidth = FullsizeImage.Width; }} Int'l NewHeight = Foolsize Image. Highlight * Nudity / Fulsize Image. With; If (NewHight> MaxHit) {// Resize with height instead of at the new height = Fullscreen image. Max * MAXHIGHT / FULLISH IMAGE. height; NewHeight = MaxHit; } System.Drawing.Image NewImage = FullsizeImage.GetThumbnailImage (NewWidth, NewHeight, Blank, IntPtr.Zero); // Handle the original file so that we can overwrite it as necessary FullsizeImage.Dispose (); // Save the resized image NewImage.Save (directory + path.directory separator cheer + newfile); }
I would recommend that you save the image as a PNG or JPEG stream Will take It would be much more efficient, given that thumbnails are not real data, it is probably okay to apply strong compression (QF & lt; 60) on it, I was successful in finding useful JPEG images once in less than 1000 bytes. At that time, they are so small that you can consider putting them in a database rather than on a disk.
Edit: (After reading the question thoroughly :))
To answer more questions, Get the result of GetThumbnailForImage ()
, then From an image
so that you can call the Save method on it, an overload allows you to specify a compression.
Comments
Post a Comment