serverlesspub / imagemagick-aws-lambda-2 Goto Github PK
View Code? Open in Web Editor NEWImageMagick for AWS Lambda 2 runtimes
Home Page: https://serverless.pub
License: Other
ImageMagick for AWS Lambda 2 runtimes
Home Page: https://serverless.pub
License: Other
According to aws official site,
Python 3.8 is running based on Amazon Linux 2
.
https://docs.aws.amazon.com/lambda/latest/dg/python-programming-model.html
As of now in README.md
, only the name of node.js was stated. what do you think of add Python 3.8
on README.md?
I've added the layer using the link ServerlessPub link and clicked deploy which added a layer named image-magick
I then attached the layer to my lambda. In my lambda I have
const gm = require('gm').subClass({imageMagick: true});
Is that using the layer? For some reason I'm unable to see any words on my image using drawText
here is my code in full
const gm = require('gm').subClass({imageMagick: true});
const { IMAGES_DIR, TEXT_SIZE, TEXT_PADDING } = process.env;
const parseText = text => (text || '').toUpperCase();
const getImages = () => fs.readdirSync(IMAGES_DIR);
const parseImage = image => getImages().find(file => file.indexOf(image) === 0);
const random = arr => arr[Math.floor(Math.random() * arr.length)];
const randomImage = () => random(getImages());
module.exports.meme = (event, context, callback) => {
const input = event.queryStringParameters || {};
const top = parseText('hello');
const bottom = parseText('mem');
const image = parseImage(input.image) || randomImage();
const meme = gm(`${IMAGES_DIR}${image}`);
meme.size(function (err, { height }) {
meme
.font('./impact.ttf', TEXT_SIZE)
.fill('white')
.stroke('black', 2)
.drawText(0, -(height / 2 - TEXT_PADDING), 'hello', 'center')
.drawText(0, height / 2 - TEXT_PADDING, bottom, 'center')
.toBuffer(function (err, buffer) {
callback(null, {
statusCode: 200,
headers: { 'Content-Type': 'image/jpeg' },
body: buffer.toString('base64'),
isBase64Encoded: true,
});
});
});
}; `
Kindly help us
any chance of adding support for HEIC format?
I've been trying to get convert something.tiff "outfilepattern.jpg"
to work in our lambdas (node 10.x).
The first thing I tried was to deploy the IM app to my account, and added the arn layer to the lambda. No matter what, it always fails with no decode delegate for tiff. The layer is installed correctly, as without it the convert
command does not exist.
I've also built from source and tried that, however the full source build (result dir) is too large to uplaod to lambdas as a layer. I also tried to copy over only the relevant lib files from that, but I always got the same error (and I'm not 100% sure which ones I need).
I've played with many different combinations of env vars (MAGICK_HOME
, MAGICK_CODER_MODULE_PATH
, DYLD_LIBRARY_PATH
, LD_LIBRARY_PATH
, MAGICK_CONFIGURE_PATH
, PATH
) without any luck.
I'm deploying with the serverless
npm module, and I've added the deployed image-magick layer to the function.
The error that occurs is:
2019-09-27T10:22:32+00:00 0:00.000 0.000u 7.0.8 Configure convert[32]: utility.c/ExpandFilenames/959/Configure
Command line: convert {-debug} {all} {-scene} {1} {\"/tmp/7811106756881616/in.tiff\"} {\"/tmp/7811106756881616/split/%05d.L.jpg\"}
2019-09-27T10:22:32+00:00 0:00.000 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Path; rights=Read; pattern=\"\"/tmp/7811106756881616/in.tiff\"\" ...
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/ImageMagick-7/locale.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/locale.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/etc/ImageMagick-7/locale.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/doc/ImageMagick-7/locale.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Configure convert[32]: locale.c/LoadLocaleCache/1206/Configure
Loading locale configure file \"/opt/share/ImageMagick-7/locale.xml\" ...
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/ImageMagick-7/english.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/english.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/etc/ImageMagick-7/english.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/doc/ImageMagick-7/english.xml\"
2019-09-27T10:22:32+00:00 0:00.001 0.000u 7.0.8 Configure convert[32]: locale.c/LoadLocaleCache/1206/Configure
Loading locale configure file \"/opt/share/ImageMagick-7/english.xml\" ...
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Exception convert[32]: blob.c/OpenBlob/3497/Exception
unable to open image '\"/tmp/7811106756881616/in.tiff\"': No such file or directory
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Cache convert[32]: cache.c/DestroyPixelCache/1039/Cache
destroy
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/share/ImageMagick-7/delegates.xml\"
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/delegates.xml\"
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/etc/ImageMagick-7/delegates.xml\"
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/share/doc/ImageMagick-7/delegates.xml\"
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Configure convert[32]: delegate.c/LoadDelegateCache/2037/Configure
Loading delegate configuration file \"/opt/etc/ImageMagick-7/delegates.xml\" ...
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Path; rights=Read; pattern=\"\"/tmp/7811106756881616/in.tiff\"\" ...
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Exception convert[32]: blob.c/OpenBlob/3497/Exception
unable to open image '\"/tmp/7811106756881616/in.tiff\"': No such file or directory
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Cache convert[32]: cache.c/DestroyPixelCache/1039/Cache
destroy
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Exception convert[32]: constitute.c/ReadImage/556/Exception
no decode delegate for this image format `TIFF\"'
2019-09-27T10:22:32+00:00 0:00.002 0.000u 7.0.8 Exception convert[32]: convert.c/ConvertImageCommand/3300/Exception
no images defined `\"/tmp/7811106756881616/split/%05d.L.jpg\"'
convert: unable to open image '\"/tmp/7811106756881616/in.tiff\"': No such file or directory @ error/blob.c/OpenBlob/3497.
convert: no decode delegate for this image format `TIFF\"' @ error/constitute.c/ReadImage/556.
convert: no images defined `\"/tmp/7811106756881616/split/%05d.L.jpg\"' @ error/convert.c/ConvertImageCommand/3300.
Some more info (sorry for fomatting, this was just dumped from a request to the lambda)
env:
LD_LIBRARY_PATH: /var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib
PATH: /var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin
command -v convert
:
/opt/bin/convert
which -a convert
:
/opt/bin/convert
convert -debug all -list configure
:
Path: /opt/lib/ImageMagick-7.0.8//config-Q16HDRI/configure.xml
Name Value
-------------------------------------------------------------------------------
CC gcc
CFLAGS -I/var/task/build/cache/include -I/var/task/build/cache/include/libpng16 -I/var/task/build/cache/include/openjpeg-2.3 -g -O2 -Wall -mtune=broadwell -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH /opt/lib/ImageMagick-7.0.8/modules-Q16HDRI/coders
CONFIGURE ./configure 'CPPFLAGS=-I/var/task/build/cache/include' 'LDFLAGS=-L/var/task/build/cache/lib' '--disable-dependency-tracking' '--disable-shared' '--enable-static' '--prefix=/opt/' '--enable-delegate-build' '--without-modules' '--disable-docs' '--without-magick-plus-plus' '--without-perl' '--without-x' '--disable-openmp' 'PKG_CONFIG_PATH=/var/task/build/cache/lib/pkgconfig'
CONFIGURE_PATH /opt/etc/ImageMagick-7/
COPYRIGHT Copyright (C) 1999-2019 ImageMagick Studio LLC
CPPFLAGS -I/opt/include/ImageMagick-7
CXX g++
CXXFLAGS -g -O2 -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib mpeg jng jpeg openjp2 png tiff webp zlib
DISTCHECK_CONFIG_FLAGS 'CPPFLAGS=-I/var/task/build/cache/include' 'LDFLAGS=-L/var/task/build/cache/lib' --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-rsvg=no --with-perl=no
DOCUMENTATION_PATH /opt/share/doc/ImageMagick-7
EXEC-PREFIX /opt
EXECUTABLE_PATH /opt/bin
FEATURES DPC HDRI Cipher
FILTER_PATH /opt/lib/ImageMagick-7.0.8/modules-Q16HDRI/filters
GIT_REVISION 15608:eea7cf511:20190505
HOST x86_64-pc-linux-gnu
INCLUDE_PATH /opt/include/ImageMagick-7
LDFLAGS -L/opt/lib -L/var/task/build/cache/lib
LIB_VERSION 0x708
LIB_VERSION_NUMBER 7,0,8,45
LIBRARY_PATH /opt/lib/ImageMagick-7.0.8
LIBS -ltiff -ljpeg -L/var/task/build/cache/lib -lpng16 -lz -L/var/task/build/cache/lib -lwebp -lbz2 -L/var/task/build/cache/lib -lopenjp2 -lz -lm
NAME ImageMagick
PCFLAGS -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /opt
QuantumDepth 16
RELEASE_DATE 2019-05-17
SHARE_PATH /opt/share/ImageMagick-7
SHAREARCH_PATH /opt/lib/ImageMagick-7.0.8/config-Q16HDRI
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR pc
VERSION 7.0.8
WEBSITE https://imagemagick.org
Path: [built-in]
Name Value
-------------------------------------------------------------------------------
DELEGATES bzlib jng jp2 jpeg png tiff webp zlib
FEATURES Cipher DPC HDRI
MAGICK_TEMPORARY_PATH /tmp
NAME ImageMagick
QuantumDepth Q16
,2019-09-27T10:17:55+00:00 0:00.000 0.000u 7.0.8 Configure convert[25]: utility.c/ExpandFilenames/959/Configure
Command line: convert {-debug} {all} {-list} {configure}
2019-09-27T10:17:55+00:00 0:00.000 0.000u 7.0.8 Configure convert[25]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/share/ImageMagick-7/configure.xml\"
2019-09-27T10:17:55+00:00 0:00.000 0.000u 7.0.8 Configure convert[25]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/configure.xml\"
2019-09-27T10:17:55+00:00 0:00.001 0.000u 7.0.8 Configure convert[25]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/etc/ImageMagick-7/configure.xml\"
2019-09-27T10:17:55+00:00 0:00.001 0.000u 7.0.8 Configure convert[25]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/share/doc/ImageMagick-7/configure.xml\"
2019-09-27T10:17:55+00:00 0:00.001 0.000u 7.0.8 Configure convert[25]: configure.c/LoadConfigureCache/1157/Configure
Loading configure file \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/configure.xml\" ...
2019-09-27T10:17:55+00:00 0:00.001 0.000u 7.0.8 Resource convert[25]: resource.c/AcquireUniqueFileResource/578/Resource
...
2019-09-27T10:17:55+00:00 0:00.001 0.000u 7.0.8 Resource convert[25]: resource.c/AcquireUniqueFileResource/634/Resource
/tmp/magick-25R6BaD20QkMsc
convert -list delegate
:
Path: /opt/etc/ImageMagick-7/delegates.xml
Delegate Command
-------------------------------------------------------------------------------
blender => \"blender' -b '%i' -F PNG -o '%o''\
'magick' convert -concatenate '%o*.png' '%o\"
bmp<= jxr \"/usr/bin/mv '%i' '%i.bmp'; 'JxrEncApp' -i '%i.bmp' -o '%o.jxr'; /usr/bin/mv '%i.bmp' '%i'; /usr/bin/mv '%o.jxr' '%o\"
bmp<= wdp \"/usr/bin/mv '%i' '%i.bmp'; 'JxrEncApp' -i '%i.bmp' -o '%o.jxr'; /usr/bin/mv '%i.bmp' '%i'; /usr/bin/mv '%o.jxr' '%o\"
bpg => \"bpgdec' -b 16 -o '%o.png' '%i'; /usr/bin/mv '%o.png' '%o\"
cdr => \"uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o\"
cgm => \"uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o\"
dng:decode => \"ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i\"
doc => \"soffice' --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /usr/bin/mv '%i.pdf' '%o\"
docx => \"soffice' --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /usr/bin/mv '%i.pdf' '%o\"
dot => \"dot' -Tsvg '%i' -o '%o\"
dvi => \"dvips' -sstdout=%%stderr -o '%o' '%i\"
dxf => \"uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o\"
eps<=>pdf \"gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 '-sDEVICE=pdfwrite' '-sOutputFile=%o' '-f%i\"
eps<=>ps \"gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=ps2write' '-sOutputFile=%o' '-f%i\"
fig => \"uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o\"
hpg => \"hp2xx' -sstdout=%%stderr -m eps -f `basename '%o'` '%i'; /usr/bin/mv -f `basename '%o'` '%o\"
hpgl => \"hp2xx' -sstdout=%%stderr -m eps -f `basename '%o'` '%i'; /usr/bin/mv -f `basename '%o'` '%o\"
htm => \"html2ps' -U -o '%o' '%i\"
html => \"html2ps' -U -o '%o' '%i\"
https => \"curl' -s -k -L -o '%o' 'https:%M\"
ilbm => \"ilbmtoppm' '%i' > '%o\"
jpg<= lep \"lepton' '%i' '%o\"
jxr => \"/usr/bin/mv '%i' '%i.jxr'; 'JxrDecApp' -i '%i.jxr' -o '%o.pnm'; /usr/bin/mv '%i.jxr' '%i'; /usr/bin/mv '%o.pnm' '%o\"
lep => \"lepton' '%i' '%o\"
miff<= show \"magick' display -immutable -delay 0 -title '%M' '%i\"
mpeg:decode => \"ffmpeg' -nostdin -v -1 -i '%i' -vframes %S -vcodec pam -an -f rawvideo -y '%u.pam' 2> '%u\"
odt => \"soffice' --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /usr/bin/mv '%i.pdf' '%o\"
pdf<=>eps \"gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sPDFPassword='%a' '-sDEVICE=eps2write' '-sOutputFile=%o' '-f%i\"
pdf<=>ps \"gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=ps2write' -sPDFPassword='%a' '-sOutputFile=%o' '-f%i\"
png<= bpg \"bpgenc' -b 12 -q '%~' -o '%o' '%i\"
png<= webp \"cwebp' -quiet %Q '%i' -o '%o\"
pnm<= ilbm \"ppmtoilbm' -24if '%i' > '%o\"
ppt => \"soffice' --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /usr/bin/mv '%i.pdf' '%o\"
pptx => \"soffice' --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /usr/bin/mv '%i.pdf' '%o\"
ps<= prt \"lpr' '%i\"
ps<=>eps \"gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=eps2write' '-sOutputFile=%o' '-f%i\"
ps<=>pdf \"gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pdfwrite' '-sOutputFile=%o' '-f%i\"
ps<= print \"@LPRDelegateDefault@ '%i\"
shtml => \"html2ps' -U -o '%o' '%i\"
sid => \"mrsidgeodecode' -if sid -i '%i' -of tif -o '%o' > '%u\"
svg => \"rsvg-convert' -o '%o' '%i\"
tiff<= launch \"gimp' '%i\"
wdp => \"/usr/bin/mv '%i' '%i.jxr'; 'JxrDecApp' -i '%i.jxr' -o '%o.bmp'; /usr/bin/mv '%i.jxr' '%i'; /usr/bin/mv '%o.bmp' '%o\"
webp => \"dwebp' -pam '%i' -o '%o\"
xls => \"soffice' --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /usr/bin/mv '%i.pdf' '%o\"
xlsx => \"soffice' --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /usr/bin/mv '%i.pdf' '%o\"
convert -list format
:
Format Mode Description
-------------------------------------------------------------------------------
3FR r-- Hasselblad CFV/H3D39II
3G2 r-- Media Container
3GP r-- Media Container
A* rw+ Raw alpha samples
AAI* rw+ AAI Dune image
AI rw- Adobe Illustrator CS2
ART* rw- PFS: 1st Publisher Clip Art
ARW r-- Sony Alpha Raw Image Format
AVI r-- Microsoft Audio/Visual Interleaved
AVS* rw+ AVS X image
B* rw+ Raw blue samples
BGR* rw+ Raw blue, green, and red samples
BGRA* rw+ Raw blue, green, red, and alpha samples
BGRO* rw+ Raw blue, green, red, and opacity samples
BMP* rw- Microsoft Windows bitmap image
BMP2* rw- Microsoft Windows bitmap image (V2)
BMP3* rw- Microsoft Windows bitmap image (V3)
BRF* -w- BRF ASCII Braille format
C* rw+ Raw cyan samples
CAL* rw- Continuous Acquisition and Life-cycle Support Type 1
Specified in MIL-R-28002 and MIL-PRF-28002
CALS* rw- Continuous Acquisition and Life-cycle Support Type 1
Specified in MIL-R-28002 and MIL-PRF-28002
CANVAS* r-- Constant image uniform color
CAPTION* r-- Caption
CIN* rw- Cineon Image File
CIP* -w- Cisco IP phone image format
CLIP* rw+ Image Clip Mask
CMYK* rw+ Raw cyan, magenta, yellow, and black samples
CMYKA* rw+ Raw cyan, magenta, yellow, black, and alpha samples
CR2 r-- Canon Digital Camera Raw Image Format
CRW r-- Canon Digital Camera Raw Image Format
CUBE* r-- Cube LUT
CUR* rw- Microsoft icon
CUT* r-- DR Halo
DATA* rw+ Base64-encoded inline images
DCM* r-- Digital Imaging and Communications in Medicine image
DICOM is used by the medical community for images like X-rays. The
specification, \"Digital Imaging and Communications in Medicine
(DICOM)\", is available at http://medical.nema.org/. In particular,
see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
and supplement 61 which adds JPEG-2000 encoding.
DCR r-- Kodak Digital Camera Raw Image File
DCRAW r-- Raw Photo Decoder (dcraw)
DCX* rw+ ZSoft IBM PC multi-page Paintbrush
DDS* rw+ Microsoft DirectDraw Surface
DNG r-- Digital Negative
DPX* rw- SMPTE 268M-2003 (DPX 2.0)
Digital Moving Picture Exchange Bitmap, Version 2.0.
See SMPTE 268M-2003 specification at http://www.smtpe.org
DXT1* rw+ Microsoft DirectDraw Surface
DXT5* rw+ Microsoft DirectDraw Surface
EPDF rw- Encapsulated Portable Document Format
EPI rw- Encapsulated PostScript Interchange format
EPS rw- Encapsulated PostScript
EPS2 -w- Level II Encapsulated PostScript
EPS3 -w+ Level III Encapsulated PostScript
EPSF rw- Encapsulated PostScript
EPSI rw- Encapsulated PostScript Interchange format
EPT rw- Encapsulated PostScript with TIFF preview
EPT2 rw- Encapsulated PostScript Level II with TIFF preview
EPT3 rw+ Encapsulated PostScript Level III with TIFF preview
ERF r-- Epson RAW Format
FAX* rw+ Group 3 FAX
FAX machines use non-square pixels which are 1.5 times wider than
they are tall but computer displays use square pixels, therefore
FAX images may appear to be narrow unless they are explicitly
resized using a geometry of \"150x100%\".
FILE* r-- Uniform Resource Locator (file://)
FITS* rw- Flexible Image Transport System
FLV rw+ Flash Video Stream
FRACTAL* r-- Plasma fractal image
FTP* --- Uniform Resource Locator (ftp://)
FTS* rw- Flexible Image Transport System
G* rw+ Raw green samples
G3* rw- Group 3 FAX
G4* rw- Group 4 FAX
GIF* rw+ CompuServe graphics interchange format
GIF87* rw- CompuServe graphics interchange format (version 87a)
GRADIENT* r-- Gradual linear passing from one shade to another
GRAY* rw+ Raw gray samples
GRAYA* rw+ Raw gray and alpha samples
GROUP4* rw- Raw CCITT Group4
HALD* r-- Identity Hald color lookup table image
HDR* rw+ Radiance RGBE image format
HISTOGRAM* -w- Histogram of the image
HRZ* rw- Slow Scan TeleVision
HTM* -w- Hypertext Markup Language and a client-side image map
HTML* -w- Hypertext Markup Language and a client-side image map
HTTP* --- Uniform Resource Locator (http://)
HTTPS* --- Uniform Resource Locator (https://)
ICB* rw- Truevision Targa image
ICO* rw+ Microsoft icon
ICON* rw- Microsoft icon
IIQ r-- Phase One Raw Image Format
INFO -w+ The image format and characteristics
INLINE* rw+ Base64-encoded inline images
IPL* rw+ IPL Image Sequence
ISOBRL* -w- ISO/TR 11548-1 format
ISOBRL6* -w- ISO/TR 11548-1 format 6dot
J2C* rw- JPEG-2000 Code Stream Syntax (2.3.1)
J2K* rw- JPEG-2000 Code Stream Syntax (2.3.1)
JNG* rw- JPEG Network Graphics
See http://www.libpng.org/pub/mng/ for details about the JNG
format.
JNX* r-- Garmin tile format
JP2* rw- JPEG-2000 File Format Syntax (2.3.1)
JPC* rw- JPEG-2000 Code Stream Syntax (2.3.1)
JPE* rw- Joint Photographic Experts Group JFIF format (libjpeg 90)
JPEG* rw- Joint Photographic Experts Group JFIF format (libjpeg 90)
JPG* rw- Joint Photographic Experts Group JFIF format (libjpeg 90)
JPM* rw- JPEG-2000 File Format Syntax (2.3.1)
JPS* rw- Joint Photographic Experts Group JFIF format (libjpeg 90)
JPT* rw- JPEG-2000 File Format Syntax (2.3.1)
JSON -w+ The image format and characteristics
K* rw+ Raw black samples
K25 r-- Kodak Digital Camera Raw Image Format
KDC r-- Kodak Digital Camera Raw Image Format
LABEL* r-- Image label
M* rw+ Raw magenta samples
M2V rw+ MPEG Video Stream
M4V rw+ Raw MPEG-4 Video
MAC* r-- MAC Paint
MAP* rw- Colormap intensities and indices
MASK* rw+ Image Clip Mask
MAT rw+ MATLAB level 5 image format
MATTE* -w+ MATTE format
MEF r-- Mamiya Raw Image File
MIFF* rw+ Magick Image File Format
MKV rw+ Multimedia Container
MNG* rw+ Multiple-image Network Graphics (libpng 1.6.37)
See http://www.libpng.org/pub/mng/ for details about the MNG
format.
MONO* rw- Raw bi-level bitmap
MOV rw+ MPEG Video Stream
MP4 rw+ MPEG-4 Video Stream
MPC* rw+ Magick Persistent Cache image format
MPEG rw+ MPEG Video Stream
MPG rw+ MPEG Video Stream
MRW r-- Sony (Minolta) Raw Image File
MSL* --- Magick Scripting Language
MSVG -w+ ImageMagick's own SVG internal renderer
MTV* rw+ MTV Raytracing image format
MVG* rw- Magick Vector Graphics
NEF r-- Nikon Digital SLR Camera Raw Image File
NRW r-- Nikon Digital SLR Camera Raw Image File
NULL* rw- Constant image of uniform color
O* rw+ Raw opacity samples
ORF r-- Olympus Digital Camera Raw Image File
OTB* rw- On-the-air bitmap
PAL* rw- 16bit/pixel interleaved YUV
PALM* rw+ Palm pixmap
PAM* rw+ Common 2-dimensional bitmap format
PANGO* --- Pango Markup Language
PATTERN* r-- Predefined pattern
PBM* rw+ Portable bitmap format (black and white)
PCD* rw- Photo CD
PCDS* rw- Photo CD
PCL rw+ Printer Control Language
PCT* rw- Apple Macintosh QuickDraw/PICT
PCX* rw- ZSoft IBM PC Paintbrush
PDB* rw+ Palm Database ImageViewer Format
PDF rw+ Portable Document Format
PDFA rw+ Portable Document Archive Format
PEF r-- Pentax Electronic File
PES* r-- Embrid Embroidery Format
PFM* rw+ Portable float format
PGM* rw+ Portable graymap format (gray scale)
PGX* rw- JPEG 2000 uncompressed format
PICON* rw- Personal Icon
PICT* rw- Apple Macintosh QuickDraw/PICT
PIX* r-- Alias/Wavefront RLE image format
PJPEG* rw- Joint Photographic Experts Group JFIF format (libjpeg 90)
PLASMA* r-- Plasma fractal image
PNG* rw- Portable Network Graphics (libpng 1.6.37)
See http://www.libpng.org/ for details about the PNG format.
PNG00* rw- PNG inheriting bit-depth, color-type from original, if possible
PNG24* rw- opaque or binary transparent 24-bit RGB (zlib 1.2.7)
PNG32* rw- opaque or transparent 32-bit RGBA
PNG48* rw- opaque or binary transparent 48-bit RGB
PNG64* rw- opaque or transparent 64-bit RGBA
PNG8* rw- 8-bit indexed with optional binary transparency
PNM* rw+ Portable anymap
PPM* rw+ Portable pixmap format (color)
PS rw+ PostScript
PS2 -w+ Level II PostScript
PS3 -w+ Level III PostScript
PSB* rw+ Adobe Large Document Format
PSD* rw+ Adobe Photoshop bitmap
PTIF* rw+ Pyramid encoded TIFF
PWP* r-- Seattle Film Works
R* rw+ Raw red samples
RADIAL-GRADIENT* r-- Gradual radial passing from one shade to another
RAF r-- Fuji CCD-RAW Graphic File
RAS* rw+ SUN Rasterfile
RAW r-- Raw
RGB* rw+ Raw red, green, and blue samples
RGBA* rw+ Raw red, green, blue, and alpha samples
RGBO* rw+ Raw red, green, blue, and opacity samples
RGF* rw- LEGO Mindstorms EV3 Robot Graphic Format (black and white)
RLA* r-- Alias/Wavefront image
RLE* r-- Utah Run length encoded image
RMF r-- Raw Media Format
RW2 r-- Panasonic Lumix Raw Image
SCR* r-- ZX-Spectrum SCREEN$
SCREENSHOT* r-- Screen shot
SCT* r-- Scitex HandShake
SFW* r-- Seattle Film Works
SGI* rw+ Irix RGB image
SHTML* -w- Hypertext Markup Language and a client-side image map
SIX* rw- DEC SIXEL Graphics Format
SIXEL* rw- DEC SIXEL Graphics Format
SPARSE-COLOR* -w+ Sparse Color
SR2 r-- Sony Raw Format 2
SRF r-- Sony Raw Format
STEGANO* r-- Steganographic image
SUN* rw+ SUN Rasterfile
SVG rw+ Scalable Vector Graphics
SVGZ -w+ Compressed Scalable Vector Graphics
TEXT* r-- Text
TGA* rw- Truevision Targa image
THUMBNAIL* -w+ EXIF Profile Thumbnail
TIFF* rw+ Tagged Image File Format (LIBTIFF, Version 4.0.9)
TIFF64* rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4.0.9)
TILE* r-- Tile image with a texture
TIM* r-- PSX TIM
TXT* rw+ Text
UBRL* -w- Unicode Text format
UBRL6* -w- Unicode Text format 6dot
UIL* -w- X-Motif UIL table
UYVY* rw- 16bit/pixel interleaved YUV
VDA* rw- Truevision Targa image
VICAR* rw- VICAR rasterfile format
VID* rw+ Visual Image Directory
VIFF* rw+ Khoros Visualization image
VIPS* rw+ VIPS image
VST* rw- Truevision Targa image
WBMP* rw- Wireless Bitmap (level 0) image
WEBP* rw- WebP Image Format (libwebp 0.6.1 [020E])
WMV rw+ Windows Media Video
WPG* r-- Word Perfect Graphics
X3F r-- Sigma Camera RAW Picture File
XBM* rw- X Windows system bitmap (black and white)
XC* r-- Constant image uniform color
XCF* r-- GIMP image
XPM* rw- X Windows system pixmap (color)
XPS r-- Microsoft XML Paper Specification
XV* rw+ Khoros Visualization image
Y* rw+ Raw yellow samples
YCbCr* rw+ Raw Y, Cb, and Cr samples
YCbCrA* rw+ Raw Y, Cb, Cr, and alpha samples
YUV* rw- CCIR 601 4:1:1 or 4:2:2
* native blob support
r read support
w write support
+ support for multiple images
convert -version
:
Version: ImageMagick 7.0.8-45 Q16 x86_64 2019-05-17 https://imagemagick.org
Copyright: \u00a9 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI
Delegates (built-in): bzlib jng jp2 jpeg png tiff webp zlib
,,2019-09-26T14:23:08+00:00 0:00.000 0.000u 7.0.8 Configure convert[32]: utility.c/ExpandFilenames/959/Configure
Command line: convert {-debug} {all} {-scene} {1} {\"/tmp/0.773477418721866/in.tiff\"} {\"/tmp/0.773477418721866/split/%05d.L.jpg\"}
2019-09-26T14:23:08+00:00 0:00.001 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-26T14:23:08+00:00 0:00.001 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-26T14:23:08+00:00 0:00.001 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Path; rights=Read; pattern=\"\"/tmp/0.773477418721866/in.tiff\"\" ...
2019-09-26T14:23:08+00:00 0:00.001 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/ImageMagick-7/locale.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/locale.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/etc/ImageMagick-7/locale.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/doc/ImageMagick-7/locale.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Configure convert[32]: locale.c/LoadLocaleCache/1206/Configure
Loading locale configure file \"/opt/share/ImageMagick-7/locale.xml\" ...
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/ImageMagick-7/english.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/english.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/etc/ImageMagick-7/english.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Locale convert[32]: locale.c/GetLocaleOptions/854/Locale
Searching for locale file: \"/opt/share/doc/ImageMagick-7/english.xml\"
2019-09-26T14:23:08+00:00 0:00.006 0.000u 7.0.8 Configure convert[32]: locale.c/LoadLocaleCache/1206/Configure
Loading locale configure file \"/opt/share/ImageMagick-7/english.xml\" ...
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Exception convert[32]: blob.c/OpenBlob/3497/Exception
unable to open image '\"/tmp/0.773477418721866/in.tiff\"': No such file or directory
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Cache convert[32]: cache.c/DestroyPixelCache/1039/Cache
destroy
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/share/ImageMagick-7/delegates.xml\"
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/lib/ImageMagick-7.0.8//config-Q16HDRI/delegates.xml\"
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/etc/ImageMagick-7/delegates.xml\"
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Configure convert[32]: configure.c/GetConfigureOptions/672/Configure
Searching for configure file: \"/opt/share/doc/ImageMagick-7/delegates.xml\"
2019-09-26T14:23:08+00:00 0:00.007 0.000u 7.0.8 Configure convert[32]: delegate.c/LoadDelegateCache/2037/Configure
Loading delegate configuration file \"/opt/etc/ImageMagick-7/delegates.xml\" ...
2019-09-26T14:23:08+00:00 0:00.008 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-26T14:23:08+00:00 0:00.008 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Path; rights=Read; pattern=\"\"/tmp/0.773477418721866/in.tiff\"\" ...
2019-09-26T14:23:08+00:00 0:00.008 0.000u 7.0.8 Exception convert[32]: blob.c/OpenBlob/3497/Exception
unable to open image '\"/tmp/0.773477418721866/in.tiff\"': No such file or directory
2019-09-26T14:23:08+00:00 0:00.008 0.000u 7.0.8 Cache convert[32]: cache.c/DestroyPixelCache/1039/Cache
destroy
2019-09-26T14:23:08+00:00 0:00.008 0.000u 7.0.8 Policy convert[32]: policy.c/IsRightsAuthorized/610/Policy
Domain: Module; rights=Read; pattern=\"TIFF\"\" ...
2019-09-26T14:23:08+00:00 0:00.008 0.000u 7.0.8 Exception convert[32]: constitute.c/ReadImage/556/Exception
no decode delegate for this image format `TIFF\"'
2019-09-26T14:23:08+00:00 0:00.008 0.000u 7.0.8 Exception convert[32]: convert.c/ConvertImageCommand/3300/Exception
no images defined `\"/tmp/0.773477418721866/split/%05d.L.jpg\"'
convert: unable to open image '\"/tmp/0.773477418721866/in.tiff\"': No such file or directory @ error/blob.c/OpenBlob/3497.
convert: no decode delegate for this image format `TIFF\"' @ error/constitute.c/ReadImage/556.
convert: no images defined `\"/tmp/0.773477418721866/split/%05d.L.jpg\"' @ error/convert.c/ConvertImageCommand/3300.
We are trying to use this layer for our lambda function which is running on graviton processors with arm64 architecture.
We are getting an error:
2022-03-23T16:18:46.638+05:30CopyI, [2022-03-23T10:48:46.638215 #11] INFO -- : Command :: PATH=/var/task/imagemagick/bin:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/50c407c68980ebe8c1f70ce5ae44e8db20220323-11-1w87jsa.png[0]' 2>/dev/null | I, [2022-03-23T10:48:46.638215 #11] INFO -- : Command :: PATH=/var/task/imagemagick/bin:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/50c407c68980ebe8c1f70ce5ae44e8db20220323-11-1w87jsa.png[0]' 2>/dev/null
-- | --
| 2022-03-23T16:18:46.645+05:30CopyI, [2022-03-23T10:48:46.645532 #11] INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError> | I, [2022-03-23T10:48:46.645532 #11] INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Just wanted to confirm if this supports arm64 as of now?
Hello,
I am following image-magick-lambda-layer to created Lambda layer, then trying to contact pictures to one tile JPEG on Lambda. However I got an error below:
So I am wondering if MONTAGE command also included in it or not?
Any information is very helpful.
Thanks in advance,
Ying
This issue indicates that nodejs 12 is compatible:
#21
If you click on deploy in the serverless app repository page and open up >Template the template tells me only NodeJS 10 is supported. Not having 12 listed results in being unable to select the layer if you are creating a NodeJS 12 lambda function.
Hi,
I'm using Makefile_ImageMagick.txt from this issue:
#6
But after a long time build I'm getting error:
Making install in src
make[2]: Entering directory `/var/task/build/fontconfig-2.13.0/src'
GEN fcobjshash.h
/var/task/build/fontconfig-2.13.0/missing: line 81: gperf: command not found
WARNING: 'gperf' is missing on your system.
You might have modified some files without having the proper
tools for further handling them. Check the 'README' file, it
often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in
case some other package contains this missing 'gperf' program.
make[2]: *** [fcobjshash.h] Error 1
make[2]: Leaving directory `/var/task/build/fontconfig-2.13.0/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/var/task/build/fontconfig-2.13.0'
make: *** [/var/task/build/cache/lib/libfontconfig.a] Error 2
make: *** [all] Error 2
I tried:
make bash
yum install -y gcc gcc-c++ cmake3 intltool flex bison shared-mime-info gperf
and then
make all
but still get issue with gperf: command not found
yum install gperf output:
bash-4.2# yum install gperf
Loaded plugins: ovl, priorities
amzn2-core | 2.4 kB 00:00:00
amzn2extra-docker | 1.3 kB 00:00:00
(1/4): amzn2-core/2/x86_64/group_gz | 2.6 kB 00:00:00
(2/4): amzn2-core/2/x86_64/updateinfo | 174 kB 00:00:01
(3/4): amzn2extra-docker/2/x86_64/primary_db | 59 kB 00:00:00
(4/4): amzn2-core/2/x86_64/primary_db | 36 MB 00:00:29
Resolving Dependencies
--> Running transaction check
---> Package gperf.x86_64 0:3.0.4-8.amzn2.0.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================
Installing:
gperf x86_64 3.0.4-8.amzn2.0.2 amzn2-core 303 k
Transaction Summary
=====================================================================================================================================================================================
Install 1 Package
Total download size: 303 k
Installed size: 601 k
Is this ok [y/d/N]: y
Downloading packages:
gperf-3.0.4-8.amzn2.0.2.x86_64.rpm | 303 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gperf-3.0.4-8.amzn2.0.2.x86_64 1/1
Verifying : gperf-3.0.4-8.amzn2.0.2.x86_64 1/1
Installed:
gperf.x86_64 0:3.0.4-8.amzn2.0.2
Complete!
Hi, thanks for sharing this.
I am looking for adding jxrlib to the layer as I need to convert jxr to jpg but I am very new to layer and never had to deal with makefile.
Can you please help me to achieve this ?
I would like to know from where do I have to start and how to test it locally (on mac) ?
Thanks!
hi,
Im not sure where this could go within the existing documentation, so I thought I could just quickly dump it into an issue (feel free to close it)
I had some trouble getting imagemagick-aws-lambda-2
to work with AWS-CDK the other night, so I thought I would share how I got it to work
const imageMagick = new CfnApplication(scope, 'imageMagick', {
location: {
applicationId: 'arn:aws:serverlessrepo:us-east-1:145266761615:applications/image-magick-lambda-layer',
semanticVersion: '1.0.0'
}
})
const lambdaFn = new lambda.Function(this, 'myLambda', {
...
layers: [
lambda.LayerVersion.fromLayerVersionArn(this, 'imageLayer', imageMagick.getAtt('Outputs.LayerVersion').toString())
]
})
The current AWS layer as published:
https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:145266761615:applications~image-magick-lambda-layer
Contains binaries for nodejs 10.x. Could another one be created to support lambda 12.x or does this support also 12.x deployments?
Cheers,
B.
I tried adding HEIF/HEIC support to the build process, the library itself builds fine but when you start building the imagemagick binaries it complains about not having any references to basic c++ libraries. See a sample below.
I am no expert on this matter, but when building this stuff in a different environment it just seems to work, so I wonder if there could be given any pointers on how to make it build correctly with libheif support built in?
Some output from the build process:
/usr/include/c++/7/bits/stl_tree.h:302: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/var/task/build/cache/lib/libheif.a(libheif_la-heif_image.o): In function `std::_Rb_tree_iterator<std::pair<heif_channel const, heif::HeifPixelImage::ImagePlane> >::operator++()':
/usr/include/c++/7/bits/stl_tree.h:287: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/var/task/build/cache/lib/libheif.a(libheif_la-heif_image.o):(.eh_frame+0x1eb): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
My additions to the Makefile_Imagemagick file:
## libheic
LIBHEIF_SOURCE=libheif-$(LIBHEIF_VERSION).tar.gz
$(LIBHEIF_SOURCE):
curl -LO https://github.com/strukturag/libheif/releases/download/v$(LIBHEIF_VERSION)/$(LIBHEIF_SOURCE)
$(CACHE_DIR)/lib/libheif.a: $(LIBHEIF_SOURCE)
tar xf $<
cd libheif*
./autogen.sh
# also tried $(CONFIGURE), same result
./configure
make
make install
Using this layer with a GM wrapper:
const GM = require('gm');
const gm = GM.subClass({ imageMagick: true });
exports.osdStamp = async (buf) => {
return new Promise((resolve, reject) => {
gm(buf)
.fontSize(40)
.drawText(10,50, 'TEST MESSAGE')
.toBuffer((err, buffer) => err ? reject(err) : resolve(buffer));
});
};
Does not put text on the image -- though it does return the image (and then save it to S3)...
Are the drawing functions of GraphicsMagik included in this layer?
Great work and thank you. This repo is very well done and perfect for my needs.
I've got one issue I'm stumped by, however. I use AWS SAM and for local development, I use sam local invoke ...
and sam local start-lambda ...
for development and testing. When running in these environments calls to convert
, identity
, etc. fail with:
Usage: magick tool [ {option} | {image} ... ] {output_image}
Usage: magick [ {option} | {image} ... ] {output_image}
magick [ {option} | {image} ... ] -script {filename} [ {script_args} ...]
magick -help | -version | -usage | -list {option}
When running on AWS it works fine so it's something limited to sam local
In the following Node example, the first call will return the above stdout and the second (calling magick directly) returns the expected output.
Calling /opt/bin/convert
:
import { exec } from 'child_process';
const promiseExec = util.promisify(exec);
const { stdout } = await promiseExec('/opt/bin/convert -version');
returns:
Usage: magick tool [ {option} | {image} ... ] {output_image}
Usage: magick [ {option} | {image} ... ] {output_image}
magick [ {option} | {image} ... ] -script {filename} [ {script_args} ...]
magick -help | -version | -usage | -list {option}
Calling /opt/bin/magick
:
import { exec } from 'child_process';
const promiseExec = util.promisify(exec);
const { stdout } = await promiseExec('/opt/bin/magick -version');
returns:
Version: ImageMagick 7.0.8-68 Q16 x86_64 2019-11-19 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI
Delegates (built-in): bzlib jng jp2 jpeg png tiff webp zlib
The only thing I can figure is that it has something to do with the symlink of convert -> magick
.
Do you have any ideas about why this might not be working and how to remedy it?
I tried this in my app but the size of the function was exceeding 262MB limit. So I dug deeper into the Makefile to see what all it includes in the final layer.zip. I saw that the lib, etc, include and share
directories along with the bin folder were included. I wondered if we really needed those and tried this:
build/layer.zip: result/bin/identify build
# imagemagick has a ton of symlinks, and just using the source dir in the template
# would cause all these to get packaged as individual files.
# (https://github.com/aws/aws-cli/issues/2900)
#
# This is why we zip outside, using -y to store them as symlinks
cd result && rm -rf lib && zip -ry $(PROJECT_ROOT)$@ *
With this the size of the result folder was brought down to 19 MB from 55 MB.
This seems to be working fine with the function I use it in.
Any thoughts?
Is it possible to include gslib to support manipulation of PDFs? I need support for PDFs in my lambda function but as of yet cannot find a solution that will work. Compiling Imagemagick from source results in a zip way too large to upload to Lambda as a layer (at least the way I am using to compile).
Thanks
I just create lambda function and used this layer. But when I add font for text in image, I get an error:
{ Error: Command failed: convert: delegate library support not built-in '/tmp/fonts/Archer-Bold.ttf' (Freetype) @ warning/annotate.c/RenderFreetype/1808. convert: non-conforming drawing primitive definition 'text' @ error/draw.c/RenderMVGContent/4397. at ChildProcess.<anonymous> (/var/task/node_modules/imagemagick/imagemagick.js:88:15) at ChildProcess.emit (events.js:198:13) at ChildProcess.EventEmitter.emit (domain.js:448:20) at maybeClose (internal/child_process.js:982:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) timedOut: false, killed: false, code: 1, signal: null }
My params: -size,863x875,xc:transparent,(,-fill,#231f20,-size,391.8412x245.1814,xc:transparent,-font,/tmp/fonts/Archer-Bold.ttf,-pointsize,22.152,-stroke,none,-draw,gravity center kerning 0 text 0,0 "I love you so",-background,none,-rotate,0.00,),-geometry,+228.4788+551.5006,-composite,/tmp/images/gexqcZl7zU.png
Can you detect for me about to solve it.
I tried this:
const exec = require('child_process').exec;
exec('convert -list font', (err, stdout, stderr) => {
console.log(stdout, err, stderr);
});
I got empty.
And drawText was ignored.
I have integrated this layer to my Lambda to use ImageMagick's convert function (TIF or JPG to PNG) and resize functions.
JPG works fine, but TIF is giving the following error
org.im4java.core.CommandException: convert: improper image header `/tmp/XYZ_IMG.TIF' @ error/tiff.c/ReadTIFFImage/1388
Did anyone using this layer encounter a similar issue? If yes, can you please post how you resolved the issue?
ImageMagick/ImageMagick#1091 says newer Image Magick build would resolve the issue. Highly appreciate it if a newer build version layer is provided for use by the community.
I am trying to build my own layer to include text capabilities (same objective as #6). First I'm testing with a clean build from the master, but get this error in make deploy
:
AWS-CLI is working, I can run aws s3 ls
and see my buckets.
The Nodejs v10 is no longer supported by AWS. Could you please update your layer to support node v20. I could not do it :((
Similar to #11 and #23, I have been trying to add AVIF support to no avail. In addition to libheif, apparently it requires libaom, but I am not able to make it work. I am not experienced in using makefiles.
I'm publishing this feature request this in case the community picks it up and someone is able to help, as AVIF is getting popular these days.
node 8.10 working fine but when we try to update node version 10.x the getting some errors.
due to an error: Error: Stream yields empty buffer
Can you please help me out.
I'm using the example function for resizing and used SNS topic event notification as I already have another function.
I'm facing this issue
{
"errorType": "TypeError",
"errorMessage": "Cannot read property 'bucket' of undefined",
"stack": [
"TypeError: Cannot read property 'bucket' of undefined",
" at Runtime.exports.handler (/var/task/index.js:13:32)",
" at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
]
}
SNS is not passing the bucket name with the object.
Any help on this, please?
Hi,
No matter what I permissions I add, I always seem to get accessdenied. It has to do with the layer as when I remove the layer the accessdenied error goes away. I added a full access policy to s3 (and triggered an update on the function by changing the timeout) but that changed nothing; still access denied.
Any ideas?
Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}
Error
{
"errorType": "AccessDenied",
"errorMessage": "Access Denied",
"trace": [
"AccessDenied: Access Denied",
" at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/services/s3.js:710:35)",
" at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)",
" at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)",
" at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:686:14)",
" at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
" at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
" at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
" at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)",
" at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:688:12)",
" at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:116:18)"
]
}
I have successfully uploaded this layer and can confirm it works for my specific purpose of converting tif to pdf.
However, I was wondering how to only use the tiff2pdf command from libtiff in order to have smaller footprint.
I tried uploading the binaries from the cache folder after compiling imagemagick, but in Lambda I get permission denied when pointing directly to the tiff2pdf binary and trying to execute a command with it.
Any ideas or hints that would point me in the right direction?
Hi
First of thanks for your great work and make it opensource.
I am looking to add freetype support so magick command can use to add watermark or datestamp on image.
Probably below block may add this (I haven't tested it)
##freetype
FREETYPE_SOURCE=freetype-$(FREETYPE_VERSION).tar.gz
$(FREETYPE_SOURCE):
curl -L http://www.imagemagick.org/download/delegates//$(FREETYPE_SOURCE) -o $(FREETYPE_SOURCE)
tar xf $<
cd freetype-*
$(CONFIGURE)
make clean
make install
Hi,
Using ImageMagick version 7.0.8-45 has some vulnerability and they are fixed at 7.1.0-52.
Highly appreciate it if a newer build version layer is provided for use by the community.
I tried following the makefile from https://github.com/serverlesspub/rsvg-convert-aws-lambda-binary and added --with-rsvg=yes to the imagemagick ./configure
but I still can't get this to work
Am I missing something?
Hi,
Need to use Wand on AWS Lamdba so I installed wand with pip in a folder and uploaded to a layer.
However, when i use wand i get next error:
wand.exceptions.MissingDelegateError: no decode delegate for this image format ' @ error/blob.c/BlobToImage/365
I found as solution in google that i need your layer to make wand work. How can i make a wand layer work with your imagemagic layer?
Best regards,
WaterKnight
I'm trying to get Wand to use this version of ImageMagick instead of the built-in one that comes with Lambda.
Running make all
none of the .so
files are anywhere to be found
As well as running ldd convert
within the docker container doesn't return the same libs as when running it on my local machine
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.