Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 29, 2007 8:21:40 AM(UTC)

cslater  
cslater

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
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, August 30, 2007 4:40:56 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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)

masique  
masique

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)

masique  
masique

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)

BoydP  
Guest

Groups: Guests
Posts: 3,034

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)

masique  
masique

Groups: Registered
Posts: 10


 
#7 Posted : Wednesday, October 3, 2007 6:52:28 AM(UTC)

BoydP  
Guest

Groups: Guests
Posts: 3,034

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.
 
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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.216 seconds.