Skip to content

Instantly share code, notes, and snippets.

@atroche
Created June 20, 2019 06:33
Show Gist options
  • Save atroche/70e12f81a242e604cb4c71410fb10e67 to your computer and use it in GitHub Desktop.
Save atroche/70e12f81a242e604cb4c71410fb10e67 to your computer and use it in GitHub Desktop.
Image resizing
Task
Constructing task
2019-06-20 16:32:40,851 TRACE [LoggingMeta] Creating log category [data]: {"categoryName":"ImageResizeTask"}
2019-06-20 16:32:40,851 INFO [ImageResizeTask] Downloading watermark [data]: {"watermarkDetails":{"position":"NorthWest","url":"https://lambda-bandwidth.s3.amazonaws.com/test/resources/watermark.jpeg?AWSAccessKeyId=AKIA5U3MLUSMWUQIJB4J&Expires=1561013260&Signature=DYS9tJ%2FErwvtiSlJmzgCAP%2B%2Bvf8%3D"}}
2019-06-20 16:32:40,854 INFO [ImageResizeTask] Starting downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"test/resources/thumb.jpg"},"filePath":"/tmp/original_image"}
2019-06-20 16:32:40,855 INFO [ImageResizeTask] Starting downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"resources/srgb.icc"},"filePath":"/tmp/srgb.icc"}
2019-06-20 16:32:40,855 INFO [ImageResizeTask] Starting downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"resources/cmyk.icc"},"filePath":"/tmp/cmyk.icc"}
2019-06-20 16:32:40,855 INFO [ImageResizeTask] Starting to run task
2019-06-20 16:32:40,856 INFO [ImageResizeTask] Generating previews [data]: {"inputLocation":{"bucket":"lambda-bandwidth","key":"test/resources/thumb.jpg"}}
2019-06-20 16:32:40,856 INFO [ImageResizeTask] Creating preview [data]: {"classifier":"img-preview"}
2019-06-20 16:32:41,168 INFO [ImageResizeTask] Finished downloading watermark
2019-06-20 16:32:41,460 INFO [ImageResizeTask] Finished downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"resources/srgb.icc"},"filePath":"/tmp/srgb.icc"}
2019-06-20 16:32:41,531 INFO [ImageResizeTask] Finished downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"test/resources/thumb.jpg"},"filePath":"/tmp/original_image"}
2019-06-20 16:32:41,532 DEBUG [ImageResizeTask] Running identify command [data]: {"identifyCommand":"identify -limit memory 256MiB -limit map 512MiB -limit area 5GiB -format \"Format: %m\nGeometry: %G\nColorspace: %[colorspace]\nDepth: %[depth]-bit\nResolution: %[resolution.x]x%[resolution.y]\nDescription: %[EXIF:ImageDescription]\nColor Profile: %[profile:icc]\" jpeg:/tmp/original_image"}
2019-06-20 16:32:42,390 INFO [ImageResizeTask] Finished downloading from S3 [data]: {"location":{"bucket":"lambda-bandwidth","key":"resources/cmyk.icc"},"filePath":"/tmp/cmyk.icc"}
2019-06-20 16:32:42,392 INFO [ImageResizeTask] Running convert command [data]: {"classifier":"img-preview","convertCommand":"convert -limit memory 256MiB -limit map 512MiB -limit area 5GiB \"jpeg:/tmp/original_image\"[0] -background 'none' -quality 85 -auto-orient -thumbnail '1500x1500>' -profile /tmp/srgb.icc -profile /tmp/srgb.icc jpeg:/tmp/img-preview_output"}
2019-06-20 16:32:42,392 INFO [ImageResizeTask] Running shell command [data]: {"command":"convert -limit memory 256MiB -limit map 512MiB -limit area 5GiB \"jpeg:/tmp/original_image\"[0] -background 'none' -quality 85 -auto-orient -thumbnail '1500x1500>' -profile /tmp/srgb.icc -profile /tmp/srgb.icc jpeg:/tmp/img-preview_output"}
2019-06-20 16:32:42,442 INFO [ImageResizeTask] Finished running shell command [data]: {"command":"convert -limit memory 256MiB -limit map 512MiB -limit area 5GiB \"jpeg:/tmp/original_image\"[0] -background 'none' -quality 85 -auto-orient -thumbnail '1500x1500>' -profile /tmp/srgb.icc -profile /tmp/srgb.icc jpeg:/tmp/img-preview_output","stdout":"","stderr":"convert: UnableToOpenConfigureFile `colors.xml' @ warning/configure.c/GetConfigureOptions/677.\n"}
2019-06-20 16:32:42,442 DEBUG [ImageResizeTask] On first pass, so adding in watermark
2019-06-20 16:32:42,442 INFO [ImageResizeTask] Running shell command [data]: {"command":"composite -gravity NorthWest \"/tmp/watermark_image\" \"/tmp/img-preview_output\" \"/tmp/img-preview_output\""}
2019-06-20 16:32:42,467 INFO [ImageResizeTask] Finished running shell command [data]: {"command":"composite -gravity NorthWest \"/tmp/watermark_image\" \"/tmp/img-preview_output\" \"/tmp/img-preview_output\"","stdout":"","stderr":""}
2019-06-20 16:32:42,467 INFO [ImageResizeTask] Got ImageMagickOptions for this content type [data]: {"imageMagickOptions":{"inputFormat":"jpeg","isDocument":false,"outputFormat":"jpeg","runThroughDcraw":false},"contentType":"image/jpeg"}
2019-06-20 16:32:42,467 TRACE [ImageResizeTask] Reading in preview file from local disk [data]: {"path":"/tmp/img-preview_output"}
2019-06-20 16:32:42,467 INFO [ImageResizeTask] Uploading to S3 [data]: {"previewOutputLocation":{"bucket":"lambda-bandwidth","key":"test/resources/thumb.jpg-img-preview"}}
2019-06-20 16:32:42,901 INFO [ImageResizeTask] Running shell command [data]: {"command":"identify -limit memory 256MiB -limit map 512MiB -limit area 5GiB -format \"Format: %m\nGeometry: %G\nColorspace: %[colorspace]\nDepth: %[depth]-bit\nResolution: %[resolution.x]x%[resolution.y]\nDescription: %[EXIF:ImageDescription]\nColor Profile: %[profile:icc]\" jpeg:/tmp/img-preview_output"}
2019-06-20 16:32:42,916 INFO [ImageResizeTask] Finished running shell command [data]: {"command":"identify -limit memory 256MiB -limit map 512MiB -limit area 5GiB -format \"Format: %m\nGeometry: %G\nColorspace: %[colorspace]\nDepth: %[depth]-bit\nResolution: %[resolution.x]x%[resolution.y]\nDescription: %[EXIF:ImageDescription]\nColor Profile: %[profile:icc]\" jpeg:/tmp/img-preview_output","stdout":"Format: JPEG\nGeometry: 1500x844\nColorspace: sRGB\nDepth: 8-bit\nResolution: 0x0\nDescription: \nColor Profile: Artifex Software sRGB ICC Profile","stderr":"identify: UnknownImageProperty \"%[EXIF:ImageDescription]\" @ warning/property.c/InterpretImageProperties/4011.\n"}
2019-06-20 16:32:42,916 INFO [ImageResizeTask] Creating preview [data]: {"classifier":"img-thumb"}
2019-06-20 16:32:42,916 INFO [ImageResizeTask] Running convert command [data]: {"classifier":"img-thumb","convertCommand":"convert -limit memory 256MiB -limit map 512MiB -limit area 5GiB \"jpeg:/tmp/img-preview_output\"[0] -background 'none' -quality 75 -auto-orient -thumbnail '300x300>' -profile /tmp/srgb.icc -profile /tmp/srgb.icc jpeg:/tmp/img-thumb_output"}
2019-06-20 16:32:42,916 INFO [ImageResizeTask] Running shell command [data]: {"command":"convert -limit memory 256MiB -limit map 512MiB -limit area 5GiB \"jpeg:/tmp/img-preview_output\"[0] -background 'none' -quality 75 -auto-orient -thumbnail '300x300>' -profile /tmp/srgb.icc -profile /tmp/srgb.icc jpeg:/tmp/img-thumb_output"}
2019-06-20 16:32:42,942 INFO [ImageResizeTask] Finished running shell command [data]: {"command":"convert -limit memory 256MiB -limit map 512MiB -limit area 5GiB \"jpeg:/tmp/img-preview_output\"[0] -background 'none' -quality 75 -auto-orient -thumbnail '300x300>' -profile /tmp/srgb.icc -profile /tmp/srgb.icc jpeg:/tmp/img-thumb_output","stdout":"","stderr":"convert: UnableToOpenConfigureFile `colors.xml' @ warning/configure.c/GetConfigureOptions/677.\n"}
2019-06-20 16:32:42,942 INFO [ImageResizeTask] Got ImageMagickOptions for this content type [data]: {"imageMagickOptions":{"inputFormat":"jpeg","isDocument":false,"outputFormat":"jpeg","runThroughDcraw":false},"contentType":"image/jpeg"}
2019-06-20 16:32:42,942 TRACE [ImageResizeTask] Reading in preview file from local disk [data]: {"path":"/tmp/img-thumb_output"}
2019-06-20 16:32:42,942 INFO [ImageResizeTask] Uploading to S3 [data]: {"previewOutputLocation":{"bucket":"lambda-bandwidth","key":"test/resources/thumb.jpg-img-thumb"}}
2019-06-20 16:32:43,413 INFO [ImageResizeTask] Running shell command [data]: {"command":"identify -limit memory 256MiB -limit map 512MiB -limit area 5GiB -format \"Format: %m\nGeometry: %G\nColorspace: %[colorspace]\nDepth: %[depth]-bit\nResolution: %[resolution.x]x%[resolution.y]\nDescription: %[EXIF:ImageDescription]\nColor Profile: %[profile:icc]\" jpeg:/tmp/img-thumb_output"}
2019-06-20 16:32:43,429 INFO [ImageResizeTask] Finished running shell command [data]: {"command":"identify -limit memory 256MiB -limit map 512MiB -limit area 5GiB -format \"Format: %m\nGeometry: %G\nColorspace: %[colorspace]\nDepth: %[depth]-bit\nResolution: %[resolution.x]x%[resolution.y]\nDescription: %[EXIF:ImageDescription]\nColor Profile: %[profile:icc]\" jpeg:/tmp/img-thumb_output","stdout":"Format: JPEG\nGeometry: 300x169\nColorspace: sRGB\nDepth: 8-bit\nResolution: 0x0\nDescription: \nColor Profile: Artifex Software sRGB ICC Profile","stderr":"identify: UnknownImageProperty \"%[EXIF:ImageDescription]\" @ warning/property.c/InterpretImageProperties/4011.\n"}
2019-06-20 16:32:43,429 INFO [ImageResizeTask] Finished generating previews [data]: {"outputPreviews":{"img-preview":{"classifier":"img-preview","contentType":"image/jpeg","id":"350da330-9325-11e9-b626-39243fd1df1e","metaData":{"height":844,"taskProcessedDate":1561012362916,"width":1500},"size":12232},"img-thumb":{"classifier":"img-thumb","contentType":"image/jpeg","id":"35561de0-9325-11e9-b626-39243fd1df1e","metaData":{"height":169,"taskProcessedDate":1561012363429,"width":300},"size":3324}}}
2019-06-20 16:32:43,430 DEBUG [ImageResizeTask] Running identify command [data]: {"identifyCommand":"identify -limit memory 256MiB -limit map 512MiB -limit area 5GiB -format \"Format: %m\nGeometry: %G\nColorspace: %[colorspace]\nDepth: %[depth]-bit\nResolution: %[resolution.x]x%[resolution.y]\nDescription: %[EXIF:ImageDescription]\nColor Profile: %[profile:icc]\" jpeg:/tmp/original_image"}
2019-06-20 16:32:43,447 INFO [ImageResizeTask] Finished running task [data]: {"outputKeyMetaData":{"description":"1920x1080 8-bit sRGB JPEG","dimensions":"1920x1080","height":1080,"width":1920,"codec":"JPEG","depth":"8-bit","colorSpace":"sRGB","preview":{"height":844,"width":1500},"thumbnail":{"height":169,"width":300}},"outputPreviews":[{"classifier":"img-preview","contentType":"image/jpeg","id":"350da330-9325-11e9-b626-39243fd1df1e","metaData":{"height":844,"taskProcessedDate":1561012362916,"width":1500},"size":12232},{"classifier":"img-thumb","contentType":"image/jpeg","id":"35561de0-9325-11e9-b626-39243fd1df1e","metaData":{"height":169,"taskProcessedDate":1561012363429,"width":300},"size":3324}],"outputResult":"OK"}
{ bucket: 'lambda-bandwidth',
key: 'test/resources/thumb.jpg-img-preview' }
{ bucket: 'lambda-bandwidth',
key: 'test/resources/thumb.jpg-img-thumb' }
✓ does the right thing for a simple JPEG with a watermark (3389ms)
1 passing (3s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment