LEADTOOLS Support
General
General Questions
Generate Thumbnails similar to Thumbnail browser control
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, August 29, 2007 8:21:40 AM(UTC)
Groups: Registered
Posts: 9
I need to generate a thumbnail per page for a multi-page tif. I've tried loading the image and resizing but the resulting image is horrible. How can I mimic the images generated by the Thumbnail browser control? It's images are wonderful.
Thanks
#2
Posted
:
Thursday, August 30, 2007 4:40:56 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
To create thumbnails from your image file, you may try to use the ReadThumbnail method.
+-------------------+
CodecsThumbnailOptions options;
options = CodecsThumbnailOptions.Default;
options.BackColor = new RasterColor(150, 150, 150);
options.BitsPerPixel = MyImage.BitsPerPixel;
options.DitheringMethod = RasterDitheringMethod.Clustered;
options.ForceSize = false;
options.Height = MyImage.Height / 5;
options.LoadStamp = false;
options.MaintainAspectRatio = true;
options.Order = RasterByteOrder.Rgb;
options.PaletteFlags = Leadtools.ImageProcessing.ColorResolutionCommandPaletteFlags.None;
options.Resample = true;
options.Width = MyImage.Width / 5;
RasterImage ThumbImage = codecs.ReadThumbnail(OpenFileDlg.FileName,options,2);
rasterImageViewer1.Image = ThumbImage.Clone() ;
ThumbImage.Dispose();
+-------------------+
Please let me know if this helps.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Tuesday, September 18, 2007 6:15:09 AM(UTC)
Groups: Registered
Posts: 10
this method does'nt work. E.g. Bitonal Images generates different that displayed in RasterThumbnailBrowser.
#4
Posted
:
Tuesday, September 18, 2007 7:12:23 AM(UTC)
Groups: Registered
Posts: 10
what if original bi-tonal image 5000x5000 and I need 100x100 thumbnail. This method also won't work.
you brutal hack "/ 5" will not mach :)
#5
Posted
:
Tuesday, September 18, 2007 7:38:54 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Could you post some example images with which this doesn't work? Make sure to put them in a zip file if you are going to upload them to the forums.
Also, if you need a 100x100 thumbnail then you would just set the options.Width = 100 and options.Height = 100. The example used "/5" to display funtionality.
#6
Posted
:
Wednesday, September 19, 2007 12:07:18 AM(UTC)
Groups: Registered
Posts: 10
#7
Posted
:
Wednesday, October 3, 2007 6:52:28 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
I sincerely apologize for the delay in getting back to you, but this code will load images identical to the thumbnail browser:
CodecsImageInfo info = this.codecs.GetInformation("c:\\280.tif", false, 1);
int width = info.Width;
int height = info.Height;
//this will be the base for calculating the size of the loaded image
Rectangle imageRect = new Rectangle(0, 0, 100, 100);
//transforms the above rectangle to one with the same aspect ratio of the image
imageRect = RasterImageList.GetFixedAspectRatioImageRectangle(width, height, imageRect);
//Bicubic is the slowest resize method, resample will work as well
rasterImageViewer1.Image = codecs.Load("c:\\280.tif", imageRect.Width, imageRect.Height, 24, RasterSizeFlags.Bicubic, info.Order, 1, 1);
I hope this helps you and once again I apologize for the delay.
LEADTOOLS Support
General
General Questions
Generate Thumbnails similar to Thumbnail browser control
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.