Page 1 of 1

ImageID

Posted: Wed Apr 27, 2011 4:07 pm
by PQSIK
Hi there,

Does GdPictureImaging ImageID always increment by 1 even when you close a form and open it again.

I have a list of ids, but if I reopen the form the new ids continues from the last id?

Like load 10 images the id would be 1 to 10, close form, open form ids from 11 to 20. This would continue till the programs stopped.

Is that how gdpicture works?

Thanks

pqsik

Re: ImageID

Posted: Sun May 01, 2011 1:08 pm
by Loïc
Hi,

No this is not exactly working like that. We use a kind of internal garbage collector, so you don't have to expect to always get +1 to each new created image.

Kind regards,

Loïc

Re: ImageID

Posted: Sun May 01, 2011 11:09 pm
by PQSIK
Thanks for the reply Loic,

I must be doing something wrong then.

I made a small program with the code I'm using, if you can have a look at please.

It crashes when the imageid gets above 6250

Thanks

pqsik

Re: ImageID

Posted: Mon May 02, 2011 9:19 am
by Loïc
Hi,

Problem is in this line:

Code: Select all

LstImage.Add(New ValuePair(String.Format("Multiple tiff {0} of {1} {2} {3}", j, PageCount, vbCrLf, str), gdp.CreateClonedGdPictureImage(TiffOutputID), Pos))
the image created by CreateClonedGdPictureImage() is never released in your code.

Kind regards,

Loïc

Re: ImageID

Posted: Mon May 02, 2011 8:08 pm
by PQSIK
Thanks again for your reply Loic,
the image created by CreateClonedGdPictureImage() is never released in your code.
In the FormClosing I loop though the list and call ReleaseGdPictureImage
I thought the code would release the image from the gdp object

Code: Select all

Private Sub frmImage_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        For Each Item As ValuePair In LstImage
            gdp.ReleaseGdPictureImage(Item.ItemValueInt)
        Next
        LstImage.Clear()
        ThumbnailEx1.ClearAllItems()
        ThumbnailEx1.Dispose()
        GdViewer1.Dispose()
    End Sub
Where would I call gdp.ReleaseGdPictureImage but keep the image in the thumbnail then?

Thanks
pqsik

Re: ImageID

Posted: Tue May 03, 2011 2:33 am
by PQSIK
I'm added gdp.ClearGdPicture() and now the ImageID starts at 0. That's what I'm looking for. Not sure if that's the way I should be doing it.

Question.

If I use the code below. Say I have a tiff file with 3 pages and I use CreateClonedGdPictureImageI
do I get a new image with 3 pages or 1 page that's the TiffSelectPage index

Code: Select all

Dim arr as New ArrayList

For j As Integer = 1 To PageCount
       gdp.TiffSelectPage(intImage, j)
       arr.add(gdp.CreateClonedGdPictureImageI(intImage))
Next
Thanks

pqsik

Re: ImageID

Posted: Tue May 03, 2011 9:21 am
by Loïc
Hi,

You get 1 page that's the TiffSelectPage index ;)

Loïc

Re: ImageID

Posted: Wed May 04, 2011 1:10 am
by PQSIK
Thanks again for your reply,

I removed most of the code and used an array list for testing and get the same results.

Can you tell me them why it's not remove a CreateClonedGdPictureImage() id from the gdp object, is it a bug in CreateClonedGdPictureImage()

I did notice that the integer added to the array list is not incrementing by 1.

it adds 2,4,6,8,10.12.....

I'm wondering if gdp creates 3,5,7,9,11..... and its that that's not getting release.

See the attachment

Thanks
pqsik

Re: ImageID

Posted: Wed May 04, 2011 11:44 am
by Loïc
Hi,

Hum... I don't understand anything.

What do you mean by "I removed most of the code and used an array list for testing and get the same results" Which result are you talking about ?

Loïc

Re: ImageID

Posted: Wed May 04, 2011 7:04 pm
by PQSIK
Hi sorry if I'm not explaining this right,

You looked at the test code attachment and says
the image created by CreateClonedGdPictureImage() is never released in your code.
Then I asked
Question.

Say I have a tiff file with 3 pages and I use CreateClonedGdPictureImageI
do I get a new image with 3 pages or 1 page that's the TiffSelectPage index
You replied
You get 1 page that's the TiffSelectPage index
So I changed the test code I uploaded to use an arraylist, I add the imageid to the arraylist from CreateClonedGdPictureImageI,
Now if i loop the arraylist and get the imageid and call gdp.ReleaseGdPictureImage(imageid)
it should release the image but somethings not right. I'm wondering if calling CreateClonedGdPictureImageI creates 2 ImageIDs and returns 1

Thanks

pqsik