ImageID

General discussions about GdPicture.NET.
Post Reply
PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

ImageID

Post by PQSIK » Wed Apr 27, 2011 4:07 pm

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

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: ImageID

Post by Loïc » Sun May 01, 2011 1:08 pm

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

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: ImageID

Post by PQSIK » Sun May 01, 2011 11:09 pm

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
Attachments
GDPictureTest.zip
(514.79 KiB) Downloaded 404 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: ImageID

Post by Loïc » Mon May 02, 2011 9:19 am

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

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: ImageID

Post by PQSIK » Mon May 02, 2011 8:08 pm

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

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: ImageID

Post by PQSIK » Tue May 03, 2011 2:33 am

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

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: ImageID

Post by Loïc » Tue May 03, 2011 9:21 am

Hi,

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

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: ImageID

Post by PQSIK » Wed May 04, 2011 1:10 am

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
Attachments
GDPictureTest.zip
(511.36 KiB) Downloaded 390 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: ImageID

Post by Loïc » Wed May 04, 2011 11:44 am

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

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: ImageID

Post by PQSIK » Wed May 04, 2011 7:04 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests