Giter Site home page Giter Site logo

imagesharp.heif's People

Contributors

hey-red avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

imagesharp.heif's Issues

Unable to load DLL 'libheif' or one of its dependencies:

Hi,

I was referred from ImageSharp to this package. I am trying to load a heic file with your package and I am getting the following error:

Unable to load DLL 'libheif' or one of its dependencies: The specified module could not be found. (0x8007007E)
Stack trace:

 at LibHeifSharp.Interop.LibHeifNative.heif_get_version_number()
  at LibHeifSharp.LibHeifInfo.GetLibHeifVersionNumber()
  at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
  at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
  at System.Lazy`1.CreateValue()
  at LibHeifSharp.LibHeifVersion.ThrowIfNotSupported()
  at LibHeifSharp.HeifContext..ctor(Stream stream, Boolean leaveOpen)
  at HeyRed.ImageSharp.Heif.HeifDecoderCore.Decode[TPixel](Stream stream, CancellationToken cancellationToken)
  at HeyRed.ImageSharp.Heif.HeifDecoder.Decode[TPixel](HeifDecoderOptions options, Stream stream, CancellationToken cancellationToken)
  at HeyRed.ImageSharp.Heif.HeifDecoder.Decode(HeifDecoderOptions options, Stream stream, CancellationToken cancellationToken)
  at SixLabors.ImageSharp.Formats.SpecializedImageDecoder`1.Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
  at SixLabors.ImageSharp.Formats.ImageDecoder.<>c__DisplayClass1_0.<Decode>b__0(Stream s)
  at SixLabors.ImageSharp.Formats.ImageDecoder.WithSeekableStream[T](DecoderOptions options, Stream stream, Func`2 action)
  at SixLabors.ImageSharp.Formats.ImageDecoder.Decode(DecoderOptions options, Stream stream)
  at SixLabors.ImageSharp.Image.Load(DecoderOptions options, String path)
  at Program.<Main>$(String[] args) in D:\Code\ffng\ConsoleApp1\Program.cs:line 27

Here is my sample program:

using HeyRed.ImageSharp.Heif.Formats.Avif;
using HeyRed.ImageSharp.Heif.Formats.Heif;
using SixLabors.ImageSharp.Formats;


var files = Directory.GetFiles(@"C:\Users\myuser\Downloads\");
var types = new List<string>() { ".jpg", ".jpeg", ".png", ".heic" };

var options = new DecoderOptions()
{
    Configuration = new Configuration(
        new AvifConfigurationModule(),
        new HeifConfigurationModule()
        )
};

foreach (var file in files.Where(f => f.Contains("7B44F_bol.heic")))
{
    var ext = Path.GetExtension(file);
    if (types.Contains(ext))
    {
        Console.WriteLine(file);
        try
        {
            var image = Image.Load(options , file);
            Console.WriteLine(image.Size.ToString());
        }
        catch (Exception ex)
        {
            Console.WriteLine($"{file} error {ex.Message}");
        }
    }
}

Console.ReadLine();

Here are the nuget packages installed:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="HeyRed.ImageSharp.Heif" Version="2.1.1" />
    <PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
  </ItemGroup>

</Project>

Unable to convert heif to jpg taken by iPhone 15 pro

When trying to convert heif images (taken with iPhone 15 pro) to jpg format, we get an error
Invalid input: Unspecified: Metadata not correctly assigned to image

Code snippet which throw an exception

private static async Task<Stream> EditImageInMemoryAsync(Stream orignalImage, Action<IImageProcessingContext> opereation, IImageFormat format)
        {
            var modifiedImage = new MemoryStream();
            using var image = await Image.LoadAsync(orignalImage);
            image.Mutate(opereation);
            image.Save(modifiedImage, format);
            modifiedImage.Position = 0;
            orignalImage.Position = 0;
            return modifiedImage;
}

Similar issue were fixed in this package.

bad-images.zip - zip file with images. With these images we get an error.

libheif not found WSA/Android ImageSharp

Thanks for this library, very helpful for what I am working on.

I am trying to load an HEIC image using ImageSharp using this library. It works on windows but when I try to load it on android (I am using WSA, haven't gotten a chance to test on actual device but I would imagine it being the same), I get libheif not found.

I have installed both 'LibHeif.Native.win-x64' and 'LibHeif.Native.linux-x64'. for some reason 'LibHeif.Native' give me errors so I had install both separately.

System.DllNotFoundException: 'libheif'

[HeifDecoderImpl] getSize: not supported!
[HeifDecoderImpl] getSize: not supported!
Loaded assembly: LibHeifSharp.dll [External]
[monodroid-assembly] Shared library 'libheif' not loaded, p/invoke 'heif_get_version_number' may fail
[monodroid-assembly] Shared library 'libheif' not loaded, p/invoke 'heif_get_version_number' may fail
[HeifDecoderImpl] getSize: not supported!
[HeifDecoderImpl] getSize: not supported!
[HeifDecoderImpl] getSize: not supported!
**System.DllNotFoundException:** 'libheif'```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.