Create a list of thumbnails

Discussions about document viewing.
Post Reply
DBr
Posts: 21
Joined: Thu Dec 09, 2010 8:21 pm

Create a list of thumbnails

Post by DBr » Mon Feb 18, 2013 12:41 am

Hi,

I'm trying to get a number of first-page thumbnails for a list of file paths. With the GdViewer.GetPageThumbnailAsBitmap() method I have the problem that I would have to load each file with the viewer. I also tried to use the ThumbnailEx class in the background to get the thumbnails, but I didn't find a way to get the thumbnails as bitmap out of the control.

Is there an alternative way to get a list of thumbnails?

Thanks for helping,

Kind regards
Dominik Braun

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Create a list of thumbnails

Post by SamiKharma » Mon Feb 18, 2013 6:21 am

Hi,

You can use the GdPictureImaging class. Load each image, then use the following:
https://www.gdpicture.com/guides/gdpicture/v9/html/con ... ation.html

Best Regards,
Sami

DBr
Posts: 21
Joined: Thu Dec 09, 2010 8:21 pm

Re: Create a list of thumbnails

Post by DBr » Wed Mar 06, 2013 2:21 pm

Hi,

at first, thanks for the quick reply. The Imaging class works so far. But recently I had a problem when there are many thumbnails to create.

The code is nearly the same as the code in the reference guides. Anyway I posted the code below, we use C#. The problem occurs after repeating the process round about 200 times. Then the line "var thumb..." returns 0. Any idea what can cause this or can you reproduce it by repeating?

Thanks for your help,
kind regards
Dominik

Code: Select all

GdPicture.GdPictureImaging gdImaging = new GdPicture.GdPictureImaging();

var id = gdImaging.CreateGdPictureImageFromFile(filename);
var thumb = gdImaging.CreateThumbnailHQ(id, gdImaging.GetWidth(id), gdImaging.GetHeight(id));
var b = gdImaging.GetBitmapFromGdPictureImage(thumb);

if (b != null)
     c.Bitmap = (Bitmap)b.Clone();
else
     c.Bitmap = null;

gdImaging.ReleaseGdPictureImage(id);
gdImaging.ReleaseGdPictureImage(thumb);

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Create a list of thumbnails

Post by SamiKharma » Wed Mar 06, 2013 8:17 pm

Hi,

I do not know, and I cannot tell this way, it could be a memory issue in your application.
In any case, could you please check GetStat function if the thumb ==0, and see what the error is.

Best,
Sami

DBr
Posts: 21
Joined: Thu Dec 09, 2010 8:21 pm

Re: Create a list of thumbnails

Post by DBr » Thu Mar 14, 2013 10:05 am

Hi,

the status is OutOfMemory, because the bitmaps which should be saved are too large. It works when the size for the CreateThumbnailHQ method is reduced. We just have to adapt it depending on the number of thumbs to create.

Another question: I noticed that a GdPictureImaging object is not able to create thumbs from pdf files. It seems we have to get a pdf plugin for that. I wondered if this is intended or a bug, because the functionality is available with the GdViewer. Can you say something about this?


Thanks
kind regards
Dominik Braun

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest