cimon-io / ansible-role-imagemagick

8 stars 4 forks source link

Support for HEIC (iPhone format) #5

Closed feliperaul closed 4 years ago

feliperaul commented 4 years ago

Hi there! Would it be possible to adapt this role to compile Imagemagick with HEIC support?

I found this tutorial (https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1) but I'm having a hard time to port it to Ansible.

merifri commented 4 years ago

Hi.

Just add these libraries to imagemagick_optional_dependencies list:

And a configuration option for HEIC support: --with-heic=yes.

So, the role will look like this:

    - role: ansible-role-imagemagick
      imagemagick_configure_options: "--with-modules --enable-shared --disable-static --without-magick-plus-plus --with-ltdl=yes --without-x --with-heic=yes"
      imagemagick_optional_dependencies:
        - libdjvulibre-dev
        - libopenexr-dev
        - liblcms2-2
        - libwmf-dev
        - libwebp-dev
        - libraw-dev
        - libfftw3-dev
        - liblqr-1-0-dev
        - libpango1.0-dev
        - libltdl-dev
        - libde265-dev
        - libheif-dev
$ identify -version
Version: ImageMagick 7.0.7-39 Q16 x86_64 2019-11-17 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf xml zlib
feliperaul commented 4 years ago

@merifri thanks for the quick reply!

Your suggested settings for the role failed with this exception:

TASK [ansible-role-imagemagick : build] ****************************************************
fatal: [STAGING1]: FAILED! => {"changed": true, "cmd": ["make", "-j2"], "delta": "0:01:02.488616", "end": "2019-11-17 21:07:23.291146", "msg": "non-zero return code", "rc": 2, "start": "2019-11-17 21:06:20.802530", "stderr": "coders/heic.c: In function ‘ReadHEICColorProfile’:\ncoders/heic.c:143:5: warning: unused variable ‘length’ [-Wunused-variable]\n     length;\n     ^~~~~~\ncoders/heic.c: In function ‘ReadHEICImage’:\ncoders/heic.c:454:9: warning: implicit declaration of function ‘heif_context_read_from_memory_without_copy’; did you mean ‘heif_context_read_from_memory’? [-Wimplicit-function-declaration]\n   error=heif_context_read_from_memory_without_copy(heif_context,file_data,\n         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n         heif_context_read_from_memory\ncoders/heic.c:454:8: error: incompatible types when assigning to type ‘struct heif_error’ from type ‘int’\n   error=heif_context_read_from_memory_without_copy(heif_context,file_data,\n        ^\nAt top level:\ncoders/heic.c:94:3: warning: ‘xmp_namespace’ defined but not used [-Wunused-const-variable=]\n   xmp_namespace[] = \"http://ns.adobe.com/xap/1.0/ \";\n   ^~~~~~~~~~~~~\nmake[1]: *** [coders/heic_la-heic.lo] Error 1\nmake[1]: *** Waiting for unfinished jobs....\nmake: *** [all] Error 2", "stderr_lines": ["coders/heic.c: In function ‘ReadHEICColorProfile’:", "coders/heic.c:143:5: warning: unused variable ‘length’ [-Wunused-variable]", "     length;", "     ^~~~~~", "coders/heic.c: In function ‘ReadHEICImage’:", "coders/heic.c:454:9: warning: implicit declaration of function ‘heif_context_read_from_memory_without_copy’; did you mean ‘heif_context_read_from_memory’? [-Wimplicit-function-declaration]", "   error=heif_context_read_from_memory_without_copy(heif_context,file_data,", "         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", "         heif_context_read_from_memory", "coders/heic.c:454:8: error: incompatible types when assigning to type ‘struct heif_error’ from type ‘int’", "   error=heif_context_read_from_memory_without_copy(heif_context,file_data,", "        ^", "At top level:", "coders/heic.c:94:3: warning: ‘xmp_namespace’ defined but not used [-Wunused-const-variable=]", "   xmp_namespace[] = \"http://ns.adobe.com/xap/1.0/ \";", "   ^~~~~~~~~~~~~", "make[1]: *** [coders/heic_la-heic.lo] Error 1", "make[1]: *** Waiting for unfinished jobs....", "make: *** [all] Error 2"], "stdout": "make  all-am\nmake[1]: Entering directory '/usr/local/src/ImageMagick-7.0.9-2'\ncp -f MagickCore/ImageMagick.pc MagickCore/ImageMagick-7.Q16HDRI.pc\ncp -f MagickCore/MagickCore.pc MagickCore/MagickCore-7.Q16HDRI.pc\ncp -f MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc\n  CC       utilities/magick.o\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-accelerate.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-animate.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-annotate.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-artifact.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-attribute.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-blob.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-cache.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-cache-view.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-channel.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-cipher.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-client.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-coder.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-color.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-colormap.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-colorspace.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-compare.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-composite.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-compress.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-configure.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-constitute.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-decorate.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-delegate.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-deprecate.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-display.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-distort.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-distribute-cache.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-draw.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-effect.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-enhance.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-exception.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-feature.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-fourier.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-fx.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-gem.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-geometry.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-histogram.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-identify.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-image.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-image-view.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-layer.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-linked-list.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-list.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-locale.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-log.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-magic.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-magick.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-matrix.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-memory.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-mime.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-module.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-monitor.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-montage.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-morphology.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-opencl.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-option.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-paint.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-pixel.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-policy.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-prepress.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-property.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-profile.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantize.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantum.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantum-export.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantum-import.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-random.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-registry.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-resample.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-resize.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-resource.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-segment.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-semaphore.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-shear.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-signature.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-splay-tree.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-static.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-statistic.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-stream.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-string.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-thread.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-timer.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-token.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-transform.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-threshold.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-type.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-utility.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-version.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-vision.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-widget.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-xml-tree.lo\n  CC       MagickCore/libMagickCore_7_Q16HDRI_la-xwindow.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-animate.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-compare.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-composite.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-conjure.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-convert.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-deprecate.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-display.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-drawing-wand.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-identify.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-import.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-cli.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-image.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-property.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-wand.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-mogrify.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-montage.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-operation.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-pixel-iterator.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-pixel-wand.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-script-token.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-stream.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-wand.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-wandcli.lo\n  CC       MagickWand/libMagickWand_7_Q16HDRI_la-wand-view.lo\n  CC       coders/aai_la-aai.lo\n  CC       coders/art_la-art.lo\n  CC       coders/avs_la-avs.lo\n  CC       coders/bgr_la-bgr.lo\n  CC       coders/bmp_la-bmp.lo\n  CC       coders/braille_la-braille.lo\n  CC       coders/cals_la-cals.lo\n  CC       coders/caption_la-caption.lo\n  CC       coders/cin_la-cin.lo\n  CC       coders/cip_la-cip.lo\n  CC       coders/clip_la-clip.lo\n  CC       coders/cmyk_la-cmyk.lo\n  CC       coders/cube_la-cube.lo\n  CC       coders/cut_la-cut.lo\n  CC       coders/dcm_la-dcm.lo\n  CC       coders/dds_la-dds.lo\n  CC       coders/debug_la-debug.lo\n  CC       coders/dib_la-dib.lo\n  CC       coders/dng_la-dng.lo\n  CC       coders/dot_la-dot.lo\n  CC       coders/dpx_la-dpx.lo\n  CC       coders/fax_la-fax.lo\n  CC       coders/fits_la-fits.lo\n  CC       coders/gif_la-gif.lo\n  CC       coders/gradient_la-gradient.lo\n  CC       coders/gray_la-gray.lo\n  CC       coders/hald_la-hald.lo\n  CC       coders/hdr_la-hdr.lo\n  CC       coders/histogram_la-histogram.lo\n  CC       coders/hrz_la-hrz.lo\n  CC       coders/html_la-html.lo\n  CC       coders/icon_la-icon.lo\n  CC       coders/info_la-info.lo\n  CC       coders/inline_la-inline.lo\n  CC       coders/ipl_la-ipl.lo\n  CC       coders/jnx_la-jnx.lo\n  CC       coders/json_la-json.lo\n  CC       coders/label_la-label.lo\n  CC       coders/mac_la-mac.lo\n  CC       coders/magick_la-magick.lo\n  CC       coders/map_la-map.lo\n  CC       coders/mask_la-mask.lo\n  CC       coders/mat_la-mat.lo\n  CC       coders/matte_la-matte.lo\n  CC       coders/meta_la-meta.lo\n  CC       coders/miff_la-miff.lo\n  CC       coders/mono_la-mono.lo\n  CC       coders/mpc_la-mpc.lo\n  CC       coders/mpeg_la-mpeg.lo\n  CC       coders/mpr_la-mpr.lo\n  CC       coders/msl_la-msl.lo\n  CC       coders/mtv_la-mtv.lo\n  CC       coders/mvg_la-mvg.lo\n  CC       coders/null_la-null.lo\n  CC       coders/otb_la-otb.lo\n  CC       coders/palm_la-palm.lo\n  CC       coders/pango_la-pango.lo\n  CC       coders/pattern_la-pattern.lo\n  CC       coders/pcd_la-pcd.lo\n  CC       coders/pcl_la-pcl.lo\n  CC       coders/pcx_la-pcx.lo\n  CC       coders/pdb_la-pdb.lo\n  CC       coders/pdf_la-pdf.lo\n  CC       coders/pes_la-pes.lo\n  CC       coders/pgx_la-pgx.lo\n  CC       coders/pict_la-pict.lo\n  CC       coders/pix_la-pix.lo\n  CC       coders/plasma_la-plasma.lo\n  CC       coders/pnm_la-pnm.lo\n  CC       coders/ps_la-ps.lo\n  CC       coders/ps2_la-ps2.lo\n  CC       coders/ps3_la-ps3.lo\n  CC       coders/psd_la-psd.lo\n  CC       coders/pwp_la-pwp.lo\n  CC       coders/raw_la-raw.lo\n  CC       coders/rgb_la-rgb.lo\n  CC       coders/rgf_la-rgf.lo\n  CC       coders/rla_la-rla.lo\n  CC       coders/rle_la-rle.lo\n  CC       coders/scr_la-scr.lo\n  CC       coders/sct_la-sct.lo\n  CC       coders/sfw_la-sfw.lo\n  CC       coders/sgi_la-sgi.lo\n  CC       coders/sixel_la-sixel.lo\n  CC       coders/stegano_la-stegano.lo\n  CC       coders/sun_la-sun.lo\n  CC       coders/svg_la-svg.lo\n  CC       coders/tga_la-tga.lo\n  CC       coders/thumbnail_la-thumbnail.lo\n  CC       coders/tile_la-tile.lo\n  CC       coders/tim_la-tim.lo\n  CC       coders/tim2_la-tim2.lo\n  CC       coders/ttf_la-ttf.lo\n  CC       coders/txt_la-txt.lo\n  CC       coders/uil_la-uil.lo\n  CC       coders/url_la-url.lo\n  CC       coders/uyvy_la-uyvy.lo\n  CC       coders/vicar_la-vicar.lo\n  CC       coders/vid_la-vid.lo\n  CC       coders/viff_la-viff.lo\n  CC       coders/vips_la-vips.lo\n  CC       coders/wbmp_la-wbmp.lo\n  CC       coders/wpg_la-wpg.lo\n  CC       coders/xbm_la-xbm.lo\n  CC       coders/xc_la-xc.lo\n  CC       coders/xcf_la-xcf.lo\n  CC       coders/xpm_la-xpm.lo\n  CC       coders/xps_la-xps.lo\n  CC       coders/xtrn_la-xtrn.lo\n  CC       coders/ycbcr_la-ycbcr.lo\n  CC       coders/yuv_la-yuv.lo\n  CC       coders/djvu_la-djvu.lo\n  CC       coders/exr_la-exr.lo\n  CC       coders/heic_la-heic.lo\n  CC       coders/jbig_la-jbig.lo\nMakefile:10379: recipe for target 'coders/heic_la-heic.lo' failed\nmake[1]: Leaving directory '/usr/local/src/ImageMagick-7.0.9-2'\nMakefile:5990: recipe for target 'all' failed", "stdout_lines": ["make  all-am", "make[1]: Entering directory '/usr/local/src/ImageMagick-7.0.9-2'", "cp -f MagickCore/ImageMagick.pc MagickCore/ImageMagick-7.Q16HDRI.pc", "cp -f MagickCore/MagickCore.pc MagickCore/MagickCore-7.Q16HDRI.pc", "cp -f MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc", "  CC       utilities/magick.o", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-accelerate.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-animate.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-annotate.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-artifact.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-attribute.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-blob.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-cache.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-cache-view.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-channel.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-cipher.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-client.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-coder.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-color.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-colormap.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-colorspace.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-compare.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-composite.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-compress.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-configure.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-constitute.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-decorate.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-delegate.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-deprecate.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-display.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-distort.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-distribute-cache.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-draw.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-effect.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-enhance.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-exception.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-feature.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-fourier.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-fx.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-gem.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-geometry.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-histogram.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-identify.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-image.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-image-view.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-layer.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-linked-list.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-list.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-locale.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-log.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-magic.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-magick.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-matrix.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-memory.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-mime.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-module.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-monitor.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-montage.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-morphology.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-opencl.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-option.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-paint.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-pixel.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-policy.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-prepress.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-property.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-profile.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantize.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantum.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantum-export.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-quantum-import.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-random.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-registry.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-resample.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-resize.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-resource.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-segment.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-semaphore.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-shear.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-signature.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-splay-tree.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-static.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-statistic.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-stream.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-string.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-thread.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-timer.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-token.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-transform.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-threshold.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-type.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-utility.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-version.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-vision.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-widget.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-xml-tree.lo", "  CC       MagickCore/libMagickCore_7_Q16HDRI_la-xwindow.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-animate.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-compare.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-composite.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-conjure.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-convert.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-deprecate.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-display.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-drawing-wand.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-identify.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-import.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-cli.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-image.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-property.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-magick-wand.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-mogrify.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-montage.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-operation.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-pixel-iterator.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-pixel-wand.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-script-token.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-stream.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-wand.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-wandcli.lo", "  CC       MagickWand/libMagickWand_7_Q16HDRI_la-wand-view.lo", "  CC       coders/aai_la-aai.lo", "  CC       coders/art_la-art.lo", "  CC       coders/avs_la-avs.lo", "  CC       coders/bgr_la-bgr.lo", "  CC       coders/bmp_la-bmp.lo", "  CC       coders/braille_la-braille.lo", "  CC       coders/cals_la-cals.lo", "  CC       coders/caption_la-caption.lo", "  CC       coders/cin_la-cin.lo", "  CC       coders/cip_la-cip.lo", "  CC       coders/clip_la-clip.lo", "  CC       coders/cmyk_la-cmyk.lo", "  CC       coders/cube_la-cube.lo", "  CC       coders/cut_la-cut.lo", "  CC       coders/dcm_la-dcm.lo", "  CC       coders/dds_la-dds.lo", "  CC       coders/debug_la-debug.lo", "  CC       coders/dib_la-dib.lo", "  CC       coders/dng_la-dng.lo", "  CC       coders/dot_la-dot.lo", "  CC       coders/dpx_la-dpx.lo", "  CC       coders/fax_la-fax.lo", "  CC       coders/fits_la-fits.lo", "  CC       coders/gif_la-gif.lo", "  CC       coders/gradient_la-gradient.lo", "  CC       coders/gray_la-gray.lo", "  CC       coders/hald_la-hald.lo", "  CC       coders/hdr_la-hdr.lo", "  CC       coders/histogram_la-histogram.lo", "  CC       coders/hrz_la-hrz.lo", "  CC       coders/html_la-html.lo", "  CC       coders/icon_la-icon.lo", "  CC       coders/info_la-info.lo", "  CC       coders/inline_la-inline.lo", "  CC       coders/ipl_la-ipl.lo", "  CC       coders/jnx_la-jnx.lo", "  CC       coders/json_la-json.lo", "  CC       coders/label_la-label.lo", "  CC       coders/mac_la-mac.lo", "  CC       coders/magick_la-magick.lo", "  CC       coders/map_la-map.lo", "  CC       coders/mask_la-mask.lo", "  CC       coders/mat_la-mat.lo", "  CC       coders/matte_la-matte.lo", "  CC       coders/meta_la-meta.lo", "  CC       coders/miff_la-miff.lo", "  CC       coders/mono_la-mono.lo", "  CC       coders/mpc_la-mpc.lo", "  CC       coders/mpeg_la-mpeg.lo", "  CC       coders/mpr_la-mpr.lo", "  CC       coders/msl_la-msl.lo", "  CC       coders/mtv_la-mtv.lo", "  CC       coders/mvg_la-mvg.lo", "  CC       coders/null_la-null.lo", "  CC       coders/otb_la-otb.lo", "  CC       coders/palm_la-palm.lo", "  CC       coders/pango_la-pango.lo", "  CC       coders/pattern_la-pattern.lo", "  CC       coders/pcd_la-pcd.lo", "  CC       coders/pcl_la-pcl.lo", "  CC       coders/pcx_la-pcx.lo", "  CC       coders/pdb_la-pdb.lo", "  CC       coders/pdf_la-pdf.lo", "  CC       coders/pes_la-pes.lo", "  CC       coders/pgx_la-pgx.lo", "  CC       coders/pict_la-pict.lo", "  CC       coders/pix_la-pix.lo", "  CC       coders/plasma_la-plasma.lo", "  CC       coders/pnm_la-pnm.lo", "  CC       coders/ps_la-ps.lo", "  CC       coders/ps2_la-ps2.lo", "  CC       coders/ps3_la-ps3.lo", "  CC       coders/psd_la-psd.lo", "  CC       coders/pwp_la-pwp.lo", "  CC       coders/raw_la-raw.lo", "  CC       coders/rgb_la-rgb.lo", "  CC       coders/rgf_la-rgf.lo", "  CC       coders/rla_la-rla.lo", "  CC       coders/rle_la-rle.lo", "  CC       coders/scr_la-scr.lo", "  CC       coders/sct_la-sct.lo", "  CC       coders/sfw_la-sfw.lo", "  CC       coders/sgi_la-sgi.lo", "  CC       coders/sixel_la-sixel.lo", "  CC       coders/stegano_la-stegano.lo", "  CC       coders/sun_la-sun.lo", "  CC       coders/svg_la-svg.lo", "  CC       coders/tga_la-tga.lo", "  CC       coders/thumbnail_la-thumbnail.lo", "  CC       coders/tile_la-tile.lo", "  CC       coders/tim_la-tim.lo", "  CC       coders/tim2_la-tim2.lo", "  CC       coders/ttf_la-ttf.lo", "  CC       coders/txt_la-txt.lo", "  CC       coders/uil_la-uil.lo", "  CC       coders/url_la-url.lo", "  CC       coders/uyvy_la-uyvy.lo", "  CC       coders/vicar_la-vicar.lo", "  CC       coders/vid_la-vid.lo", "  CC       coders/viff_la-viff.lo", "  CC       coders/vips_la-vips.lo", "  CC       coders/wbmp_la-wbmp.lo", "  CC       coders/wpg_la-wpg.lo", "  CC       coders/xbm_la-xbm.lo", "  CC       coders/xc_la-xc.lo", "  CC       coders/xcf_la-xcf.lo", "  CC       coders/xpm_la-xpm.lo", "  CC       coders/xps_la-xps.lo", "  CC       coders/xtrn_la-xtrn.lo", "  CC       coders/ycbcr_la-ycbcr.lo", "  CC       coders/yuv_la-yuv.lo", "  CC       coders/djvu_la-djvu.lo", "  CC       coders/exr_la-exr.lo", "  CC       coders/heic_la-heic.lo", "  CC       coders/jbig_la-jbig.lo", "Makefile:10379: recipe for target 'coders/heic_la-heic.lo' failed", "make[1]: Leaving directory '/usr/local/src/ImageMagick-7.0.9-2'", "Makefile:5990: recipe for target 'all' failed"]}
feliperaul commented 4 years ago

@merifri From what I could gather from that error message, it seems that imagemagick will only compile with HEIC support if it has libheif version >= 1.3.0 (source: https://github.com/ImageMagick/ImageMagick/issues/1534#issuecomment-502088950)

On Ubuntu 18.04, without adding any extra PPAs, apt will install version 1.1.0-2 of libheif-dev, and it's the newest version available to Bionic.

However, since you posted your identify -version command, I think you somehow made it work.

merifri commented 4 years ago

Yes, ImageMagick 7.0.8+ does not compile with old libraries from the repository. You can install libde265(-dev) and libheif(-dev) from source.

Would it be possible to adapt this role to compile Imagemagick with HEIC support?

No, it is not possible. I think that in this case it would be better to create a new role to install the necessary dependencies.

However, since you posted your identify -version command, I think you somehow made it work.

I did not update imagemagick. Installed version: 7.0.7

feliperaul commented 4 years ago

@merifri I'll try to come up with this role by following that medium article I posted above. If I succeed, I'll post it here and maybe it can help others in the future.

feliperaul commented 4 years ago

Managed to do it.

I'm posting below so it can help anyone in the future. Feel free to comment.

- name: Check if imagemagick is installed
  shell: "identify -version"
  changed_when: false
  failed_when: false
  register: check_image_magick

- set_fact:
    image_magick_is_installed: "{{ check_image_magick.stderr == '' }}"

- when: image_magick_is_installed
  name: ImageMagick
  debug:
    msg: "ImageMagick is already installed"

- block:cache

  # Source: https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1
  - name: ImageMagick
    debug:
      msg: Starting imagemagick install

  - name: Replace apt sources
    replace:
      path: /etc/apt/sources.list
      regexp: '^# deb-src '
      replace: 'deb-src '

  - name: Update apt and install packages
    apt:
      name: "{{ packages }}"
      state: present
      update_cache: yes
      cache_valid_time: 0
    vars:
      packages:
        - build-essential
        - autoconf
        - libtool

  - name: Install build build dependencies
    apt:
      name: "{{ packages }}"
      state: build-dep
      cache_valid_time: 0
    vars:
      packages:
        - imagemagick
        - libmagickcore-dev
        - libde265
        - libheif

  - name: Clone libde265 repo
    git:
      repo: 'https://github.com/strukturag/libde265.git'
      dest: /usr/src/libde265

  - name: "autogen libde265"
    shell: "./autogen.sh"
    args:
      chdir: "/usr/src/libde265"
      creates: "/usr/src/libde265/configure"

  - name: "configure libde265"
    shell: "./configure"
    args:
      chdir: "/usr/src/libde265"
      creates: "/usr/src/libde265/Makefile"

  - name: make and install 
    shell: make && make install 
    args:
      chdir: "/usr/src/libde265"

  - name: Clone libheif repo
    git:
      repo: 'https://github.com/strukturag/libheif.git'
      dest: /usr/src/libheif

  - name: "autogen libheif"
    shell: "./autogen.sh"
    args:
      chdir: "/usr/src/libheif"
      creates: "/usr/src/libheif/configure"

  - name: "configure libheif"
    shell: "./configure"
    args:
      chdir: "/usr/src/libheif"
      creates: "/usr/src/libheif/Makefile"

  - name: make and install 
    shell: make && make install 
    args:
      chdir: "/usr/src/libheif"

  - name: "find latest imagemagick patch version"
    uri:
      url: "{{ imagemagick_releases_url }}"
      return_content: yes
    register: imagemagick_releases_page

  - name: "set vars: IM patch version"
    set_fact:
      imagemagick_patch_version: "{{ imagemagick_releases_page.content | regex_search('ImageMagick-'+imagemagick_version+'-[0-9]{1,3}.tar.xz') | regex_replace('^.*-(.*)\\.tar\\.xz','\\1') }}"

  - name: "set vars: IM filename"
    set_fact:
      imagemagick_file: "ImageMagick-{{ imagemagick_version + '-' + imagemagick_patch_version }}"

  - name: "get source"
    get_url:
      url: "{{ imagemagick_releases_url }}/{{ imagemagick_file }}.tar.xz"
      dest: "{{ imagemagick_source_path }}/{{ imagemagick_file }}.tar.xz"

  - name: "extract archive"
    unarchive:
      src: "{{ imagemagick_source_path }}/{{ imagemagick_file }}.tar.xz"
      dest: "{{ imagemagick_source_path }}/"
      copy: no
      creates: "{{ imagemagick_source_path }}/{{ imagemagick_file }}"

  - name: "autogen imagemagick"
    shell: "./autogen.sh"
    args:
      chdir: "{{ imagemagick_source_path }}/{{ imagemagick_file }}"
      creates: "{{ imagemagick_source_path }}/{{ imagemagick_file }}/configure"

  - name: "configure"
    shell: "./configure {{ imagemagick_configure_options }}"
    args:
      chdir: "{{ imagemagick_source_path }}/{{ imagemagick_file }}"
      creates: "{{ imagemagick_source_path }}/{{ imagemagick_file }}/config.status"

  - name: "build"
    shell: "make -j{{ ansible_processor_cores|default(1) }}"
    args:
      chdir: "{{ imagemagick_source_path }}/{{ imagemagick_file }}"
      creates: "{{ imagemagick_source_path }}/{{ imagemagick_file }}/utilites/.libs"

  - name: "install"
    shell: "make install"
    args:
      chdir: "{{ imagemagick_source_path }}/{{ imagemagick_file }}"

  - name: 'ldconfig'
    shell: 'ldconfig'

  when: not image_magick_is_installed