We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hosting Aspose.Imaging aspnet.core on Alpine Linux

Are there apt-get commands that required to run Aspose.Imaging on an Alpine Linux Docker Image

I have a web service built on the Aspose family (Words, PDF, and Imaging) to convert a list of submitted documents PDF (versions 22.7 and 22.8)

This service works great on a Windows Server, however when hosted on a Linux Alpine Docker image Aspose.Imaging.Image.Load(inputStream) throws the exception, “Image loading failed.”

There are apt-get commands posted on this support site to update the Docker image with required libraries for Aspose.Words, and Aspose.PDF, but I haven’t found anything for Aspose.Imaging.

@mcrose, you need to install libgdiplus from mono, as well as a minimum set of fonts.
For Ubuntu dockerfile looks like this:

RUN apt-get update \
    && apt-get install -y \
        apt-transport-https \
        dirmngr \
        gnupg \
        ca-certificates

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
    && echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" >> /etc/apt/sources.list.d/mono-official-stable.list

    
RUN apt-get update && apt-get install -y libgdiplus libc6-dev libx11-dev libfontconfig1 xfonts-utils


RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ttf-mscorefonts-installer

Thank you for the suggestion.
I tried it, and has not helped (DOCKERFILE below)

Any other suggestions?

The exception is thrown from
Aspose.Imaging.Image.Load(inputStream)

The exception and inner exceptions are logged
TifToPdfStream() inputStream.length=1272
TifToPdfStream() Exception.Message: Image loading failed.
InnerEx: Unable to read file. Exception: The type initializer for ‘Gdip’ threw an exception.
Stack =
at Aspose.Imaging.Image.Load(StreamContainer , LoadOptions )
at Aspose.Imaging.Image.Load(Stream stream, LoadOptions loadOptions)
at Aspose.Imaging.Image.Load(Stream stream)

DOCKERFILE

FROM:mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic

RUN apt-get update && apt-get install -y --no-install-recommends gss-ntlmssp

ENV DEBIAN_FRONTEND=noninteractive
ENV ACCEPT_EULA=Y

RUN apt-get update
&& apt-get install -y --allow-unauthenticated
libc6-dev
libgdiplus
libx11-dev
ttf-mscorefonts-installer
&& rm -rf /var/lib/apt/lists/*

Aspose.Imaging

Hosting Aspose.Imaging aspnet.core on Alpine Linux

RUN apt-get update && apt-get install -y libgdiplus libc6-dev libx11-dev libfontconfig1 xfonts-utils
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ttf-mscorefonts-installer

#Apose.Words

https://docs.aspose.com/words/net/how-to-run-aspose-words-in-docker/

RUN apt-get update && apt-get install -y libfontconfig1
RUN apt-get -y install libharfbuzz-icu0

RUN apt-get update && apt-get install -y libgdiplus libc6-dev libx11-dev libfontconfig1 xfonts-utils
RUN DEBIAN_FRONTEND=noninteractive && -get install -y ttf-mscorefonts-installer

@mcrose, I added a test project with a dockerfile, this project runs under Linux.
You can take the dockerfile from there and modify it to suit your needs. TestProject.zip (592.1 KB)