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

Loading a Raster image throws DllNotFoundException for 'libglib-2.0-0.dll' #206

Closed
MindSwipe opened this issue Mar 20, 2023 · 3 comments
Closed

Comments

@MindSwipe
Copy link

To Reproduce

  1. Create a new Console app
  2. Reference GTiff2Tiles 2.0.0-rc3
  3. Copy and paste the following code
var progress = new Progress<double>(ProgressReporter);
var printTimeAction = new Action<string>(System.Console.WriteLine);

await using Raster image = new("path/to/image.tif");
await image.WriteTilesToDirectoryAsync(
    "path/to/outDir",
    0,
    20,
    tileSize: new Size(256, 256),
    progress: progress,
    printTimeAction: printTimeAction
);
  1. Execute the program

Input data info
gdalinfo output:

Driver: GTiff/GeoTIFF
Files: 2138_1000_11.tif
       2138_1000_11.tfw
Size is 16468, 13031
Origin = (588667.743266666657291,162231.896333333395887)
Pixel Size = (0.042333333333000,-0.042333333333000)
Metadata:
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  INTERLEAVE=BAND
  MINISWHITE=YES
Corner Coordinates:
Upper Left  (  588667.743,  162231.896)
Lower Left  (  588667.743,  161680.251)
Upper Right (  589364.889,  162231.896)
Lower Right (  589364.889,  161680.251)
Center      (  589016.316,  161956.074)
Band 1 Block=16468x4 Type=Byte, ColorInterp=Palette
  Image Structure Metadata:
    NBITS=1
  Color Table (RGB with 2 entries)
    0: 255,255,255,255
    1: 0,0,0,255

Expected behavior
I expect the program to correctly load the image and generate tiles

Actual behaivor
The program crashes on the line where a new Raster is created with the following exception:

System.DllNotFoundException: 'Unable to load DLL 'libglib-2.0-0.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)'

Desktop:

  • OS: Windows 10 64 bit version 21H2
  • Version: 2.0.0-rc3 using the Nuget package
@Gigas002
Copy link
Owner

Gigas002 commented Apr 4, 2023

Sorry I kept you waiting for an answer. I'm no longer commiting to this project lately, but I'll try to help you.
It looks like prebuilt gdal or netvips had some errors with dependencies. Could you please try building library from source code and reference it? I've merged all related PRs from dependabot and CI seems to work fine.

@clayu
Copy link

clayu commented May 14, 2023

I had an error similar to this. It was solved by importing the references that the GTiff2Tiles.Console's package dependencies into my root project. I don't think they are all required, but here they all are:

  • CommandLineParser
  • MaxRev.Gdal.LinuxRuntime.Minimal
  • MaxRev.Gdal.WindowsRuntime.Minimal
  • NetVips.Native.linux-x64
  • NetVips.Native.win-x64

@Gigas002
Copy link
Owner

Ah, sorry, I misread the question, thought you're using the console app from repo. @clayu is right, you'll need to reference a native packages, that match your system (as name says, CommandLineParser is only needed to parse options from command line, so it's optional)

By the way, it seems like gdal native bindings are finally available under macos, so in case you're using mac, you'll need to add two additional packages to your console application:

  • dotnet add package NetVips.Native.osx-x64 (or dotnet add package NetVips.Native for automatic native bindings for all supported OS)
  • dotnet add package MaxRev.Gdal.MacosRuntime.Minimal.x64 for gdal natives

Though I can't assure you it will work on mac. I will push these changes to github's CI environment soon.

I'm closing this issue for now, but feel free to reopen it.

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

No branches or pull requests

3 participants