Loading...

Getting the ImageID 0

Discussions about image processing in GdPicture.NET using GdPictureImaging.

Getting the ImageID 0

Postby tanmoym » Wed Jan 05, 2011 10:25 am

Hello,
I am generating thumbnails from a folder using
Code: Select all
CreateGdPictureImageFromFile(fileName)
.
Sometimes I am getting 0 as ImageID. The Image is not corrupt and can be viewed in any other previewer.

sample Code:

Code: Select all
foreach (string file in files)
{
m_CurrentImage = Imaging1.CreateGdPictureImageFromFile(file);
m_CurrentThumbnail = Imaging1.CreateThumbnail(m_CurrentImage, 90, 90);
}


I am getting 0 as m_CurrentImage.

What can be the reason for this ?
Any help will be appreciated.

Thanks,
Tanmoy Mitra
tanmoym
 
Posts: 4
Joined: Wed Jan 05, 2011 9:06 am

Re: Getting the ImageID 0

Postby Loïc » Wed Jan 05, 2011 12:38 pm

Hi,

Could you attach the file which can't be opened ?
I suppose this is not an image or an unsupported format by GdPicture.

Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4442
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Getting the ImageID 0

Postby tanmoym » Wed Jan 05, 2011 2:39 pm

Hi Loïc,
it just a JPEG image, which already open in single viewer application. can GDPicture supports CACHE for thumbnails ?
Thanks,
Tanmoy
tanmoym
 
Posts: 4
Joined: Wed Jan 05, 2011 9:06 am

Re: Getting the ImageID 0

Postby Loïc » Wed Jan 05, 2011 2:58 pm

Hi,

I don't understand the question. What is "CACHE" ?

Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4442
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Getting the ImageID 0

Postby tanmoym » Thu Jan 06, 2011 7:49 am

Hi,

My application is an image viewer application.I am generating thumbnails of n number of images in a folder. When i click on a particular folder say "FolderA", then thumbnails of all the images are generated in a loop using "CreateThumbnail" and also saving the generated thumbnails in bitmap format in some memory location. The process of saving the data (images in this case) in memory for further use is known as Caching. Now, I want whenever I click again on "FolderA", instead of generating thumbnails again, I will retrieve them from the cache. This will save the amount of time in thumbnail generation and will make my application faster.

My question is does GD has its own cache or does it saves the images somewhere in the memory that can be retrieved by the image ID?

Thanks
Tanmoy
tanmoym
 
Posts: 4
Joined: Wed Jan 05, 2011 9:06 am

Re: Getting the ImageID 0

Postby TheBG » Mon Feb 28, 2011 10:17 pm

Has anyone replied to this thread? I get the same 0 return value when I try to use the same code to open a PDF file. Here is my exact code:
Code: Select all
'---browse for file to open
 If OpenFileDialog1.ShowDialog = DialogResult.OK Then
            Dim filePath As String = OpenFileDialog1.FileName

            '---open selected PDF file using a FileStream---
            Dim fs As New FileStream(filePath, FileMode.Open)
            fs.Seek(0, SeekOrigin.Begin) 'rewind stream object back to 0

            '---create GdPictureImage from FileStream
            m_CurrentImage = Imaging1.CreateGdPictureImageFromStream(fs) 'THIS LINE RETURNS:    0       
            'THE CODE IN THE NEXT LINE ALSO RETURNS 0 if one tries to open PDF's. TIF's load fine.
            'm_CurrentImage = Imaging1.CreateGdPictureImageFromFile(filePath) 'THIS LINE RETURNS:    0

            '---display images           
            GdViewer1.DisplayFromGdPictureImage(m_CurrentImage)
            ThumbnailEx1.LoadFromGdViewer(GdViewer1)
        End If
TheBG
 
Posts: 1
Joined: Mon Feb 28, 2011 8:59 pm

Re: Getting the ImageID 0

Postby Loïc » Tue Mar 01, 2011 10:09 am

The line returns 0 because you are trying to open a PDF with a function that is supposed to open Image.
If you want to open PDF you have to use the PDFReader... functions.

Kind regards,

Loïc


Note: Please try to create a new thread for any new issue.
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4442
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to Image Processing

Who is online

Users browsing this forum: No registered users and 0 guests

cron