Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete original image file after calling NetVips.Image.Tiffsave #6

Closed
goarsna opened this issue Jun 4, 2018 · 2 comments
Closed
Labels
question Further information is requested

Comments

@goarsna
Copy link

goarsna commented Jun 4, 2018

Hi,

I encounter errors trying to delete an input JPEG file after saving it to a TIFF file by calling NetVips.Image.Tiffsave(). Although Internal.GObject.GObjectUnref() and Internal.VipsObject.VipsObjectUnrefOutputs() are called it seems that not all handles are released.

Are there any additional steps I have to take, to fully release handles on the input image?

I'm using libvips 8.6.3 and NetVips 1.0.2. If you need any further information just let me know.

Thank you in advance.

@kleisauke
Copy link
Owner

kleisauke commented Jun 4, 2018

Hello, I think the file is being held open in libvips' cache.

You could try to set the file cache to zero:

// NetVips >= 2.0.0
Cache.MaxFiles = 0;
// NetVips < 2.0.0
//NetVips.CacheSetMaxFiles(0);

before saving it to a TIFF file. See here for more info.

@kleisauke kleisauke added the question Further information is requested label Jun 4, 2018
@goarsna
Copy link
Author

goarsna commented Jun 5, 2018

Hey,

thank you for your quick response. Now i got it working. In addition to setting VipsCacheSetMaxFiles to 0 I also had to set VipsCacheSetMax to 0.

My solution now is calling this little method at program startup:

void InitializeNetVips()
{
	NetVips.ModuleInitializer.Initialize();
	NetVips.Operation.VipsCacheSetMax(0);
	NetVips.Operation.VipsCacheSetMaxFiles(0);
}

Thanks again for your help and the great work you did with NetVips!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants