Skip to content

Commit

Permalink
WIP [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
navidemad committed Aug 1, 2024
1 parent db06667 commit d3e13c4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 27 deletions.
39 changes: 19 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

# Heroku Buildpack for ImageMagick with HEIF/HEIC/AVIF/WebP Support

```
_____ _ _
\_ \_ __ ___ __ _ __ _ ___ /\/\ __ _ __ _(_) ___| | __
Expand All @@ -10,46 +7,48 @@
|___/ |___/
```

# Heroku Buildpack for ImageMagick

[![Build Status](https://github.com/yespark/heroku-imagemagick-buildpack/workflows/ci/badge.svg)](https://github.com/yespark/heroku-imagemagick-buildpack/actions?query=workflow%3Aci)

# Documentation

With the rise in popularity of HEIF/HEIC (High Efficiency Image Format), your project needs to handle this format efficiently. The default version of ImageMagick installed on Heroku:22/24 dynos (version 7.xx) does not support processing HEIC and AVIF image files.
With the rise in popularity of HEIF/HEIC/AVIF/WebP formats, your project needs to handle this format efficiently.
The default version of ImageMagick installed on Heroku:22/24 dynos (version 7.xx) does not support processing HEIC and AVIF image files.

This [Heroku buildpack](https://devcenter.heroku.com/articles/buildpacks) includes a version of ImageMagick with **HEIF/HEIC/AVIF/WebP support**.

The binaries in this repository were built using Heroku Docker images with the [**build.sh**](./build.sh) script. The resulting tar files are stored in the `/build` directory and utilized by the [compile script](./bin/compile).

The `/build` directory currently contains:

Versions:
- ImageMagick 7.1.1-35
- libde265 1.0.15
- libwebp 1.4.0
- libheif 1.18.1

# Using the Heroku Imagemagick buildpack
The binaries in this repository were built using Heroku Docker images with the [**build.sh**](./build.sh) script. The resulting tar files are stored in the `/build` directory and utilized by the [compile script](./bin/compile).

# Usage

It's suggested that you use the latest version of the release buildpack. You can set it using the heroku-cli.
It's suggested that you use the latest version of the release buildpack.
To ensure the newer version of ImageMagick is found in the `$PATH` and installed first, make sure this buildpack is added to the top of the buildpack list (index 1).
You can set it using the heroku-cli.

```bash
heroku buildpacks:set https://github.com/yespark/heroku-imagemagick-buildpack --index 1 -a your-app-name
```

Your builds will always used the latest published release of the buildpack.
# Notes

**NOTE:**
- To ensure the newer version of ImageMagick is found in the `$PATH` and installed first, make sure this buildpack is added to the top of the buildpack list (index 1).
- If needed, clear the cache due to configuration changes:
If needed, clear the cache due to configuration changes:

```bash
heroku plugins:install heroku-builds
heroku builds:cache:purge -a HEROKU_APP_NAME
heroku plugins:install @heroku-cli/heroku-builds
heroku builds:cache:purge -a your-app-name
```

## Development
## Workflow

This Dockerfile builds ImageMagick with updated libraries (libde265, libwebp, and libheif) on a Heroku stack. Here's a breakdown of the process:
This Dockerfile builds ImageMagick with updated libraries (libde265, libwebp, and libheif) on a Heroku stack.
Here's a breakdown of the process:

- Starts with a Heroku build image and sets up environment variables and arguments.
- Installs necessary dependencies like `pkg-config`, `ninja-build`, and `yasm`.
Expand All @@ -70,9 +69,9 @@ This Dockerfile builds ImageMagick with updated libraries (libde265, libwebp, an

The result is a Docker image with updated versions of ImageMagick and its dependencies, with shared libraries (.so files) built and included in a tarball.

## Bugs
## Contributing

Please report all bugs to the issue tracker: https://github.com/yespark/heroku-imagemagick-buildpack/issues
Contributions to the plugin are welcome. Report bugs and suggestions using GitHub Issues on the repository.

## License

Expand Down
4 changes: 2 additions & 2 deletions build/configurations/heroku-24.config.log
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ HOST x86_64-pc-linux-gnu
INCLUDE_PATH /usr/local/include/ImageMagick-7
LDFLAGS -L/usr/local/lib
LIB_VERSION 0x711
LIB_VERSION_NUMBER 7,1,1,35
LIB_VERSION_NUMBER 7,1,1,36
LIBRARY_PATH /usr/local/lib/ImageMagick-7.1.1
LIBS -ljbig -llcms2 -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lpng16 -ldjvulibre -lfontconfig -lfreetype -L/usr/local/lib -lheif -L/usr/local/lib -lwebpmux -lwebpdemux -L/usr/local/lib -lwebp -lXext -lXt -lSM -lICE -lX11 -llzma -lbz2 -lopenjp2 -lxml2 -lz -lm -lpthread -lgomp
NAME ImageMagick
PCFLAGS -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_CHANNEL_MASK_DEPTH=32
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2024-07-13
RELEASE_DATE 2024-07-26
SECURITY_POLICY open
SHARE_PATH /usr/local/share/ImageMagick-7
SHAREARCH_PATH /usr/local/lib/ImageMagick-7.1.1/config-Q16HDRI
Expand Down
Binary file modified build/heroku-24.tar.bz2
Binary file not shown.
10 changes: 5 additions & 5 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ENV STACK="heroku-${STACK_VERSION}" \
ARG COMPILE_VERSION_LIBDE265=1.0.15
ARG COMPILE_VERSION_LIBWEBP=1.4.0
ARG COMPILE_VERSION_LIBHEIF=1.18.1
ARG COMPILE_VERSION_IMAGEMAGICK=7.1.1-35
ARG COMPILE_VERSION_IMAGEMAGICK=7.1.1-36

USER root
WORKDIR /usr/local/src
Expand All @@ -39,7 +39,7 @@ RUN set -ex \
&& ./autogen.sh \
&& ./configure --prefix=$PREFIX \
&& make V=0 --jobs=$(nproc) \
&& make install
&& make install --jobs=$(nproc)

# Build and install libwebp
RUN set -ex \
Expand All @@ -49,7 +49,7 @@ RUN set -ex \
&& ./autogen.sh \
&& ./configure --prefix=$PREFIX --enable-shared --enable-static=no --enable-libwebpdecoder --enable-libwebpdemux --enable-libwebpmux \
&& make V=0 --jobs=$(nproc) \
&& make install
&& make install --jobs=$(nproc)

# Build and install libheif
RUN set -ex \
Expand All @@ -65,7 +65,7 @@ RUN set -ex \
&& cd build \
&& cmake --preset=release-noplugins -DCMAKE_INSTALL_PREFIX=$PREFIX -DWITH_EXAMPLES=OFF .. \
&& make V=0 --jobs=$(nproc) \
&& make install
&& make install --jobs=$(nproc)

# Build and install ImageMagick
RUN set -ex \
Expand All @@ -74,7 +74,7 @@ RUN set -ex \
&& curl --retry-connrefused --retry 3 -ksSL "https://api.github.com/repos/ImageMagick/ImageMagick/tarball/${COMPILE_VERSION_IMAGEMAGICK}" | tar zx --strip-components=1 \
&& ./configure --prefix=$PREFIX --enable-shared=yes --disable-docs --disable-static --without-gvc --without-openexr --without-tiff --without-zip \
&& make V=0 --jobs=$(nproc) \
&& make install
&& make install --jobs=$(nproc)

# Clean and package
RUN set -ex \
Expand Down

0 comments on commit d3e13c4

Please sign in to comment.