ImageMagick

快速搭建 Serverless 在线图片处理应用

时间秒杀一切 提交于 2019-12-13 15:08:10
简介 首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute) :函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。 ImageMagick :ImageMagick 是一个用于查看、编辑位图文件以及进行图像格式转换的开放源代码软件套装。它可以读取、编辑超过100种图象格式。 ImageMagick 是图片处理的利器,借助 ImageMagick 可以轻松实现图片的裁剪和缩放。虽然很多语言都封装了 ImageMagick 的调用库,但是把图片处理功能和核心业务功能放在同一个服务内,在软件架构上往往不适合。有如下两方面的原因: 一方面,图片处理依赖外部的 bin,已经编译好的二级制不具备可移植性,给打包发布带来了麻烦。另一方面,图片处理往往是比较耗费计算资源的,对于大多数业务系统来说图片处理属于边缘业务,而非核心业务,所以为整个服务预留较多的计算资源是不划算的。更好的选择是把图片处理类业务以微服务的形式切分出来,部署在具备弹性的底层服务之上。对于此类技术需求, Serverless 是非常切合的。 本文重点介绍如何快速地在函数计算平台上部署一个弹性高可用的图片处理服务,然后在此基础上轻松的定制化。 快速开始

ImageMagick cropping large image into xyz tiles

别说谁变了你拦得住时间么 提交于 2019-12-13 13:28:13
问题 i'm having a large jpg, which has a resolution of x * 256 / x * 256. I want to cut this image into 256x256 tiles with a naming convention {zoom}-{x}-{y}.jpg. In the past i've used ZoomifyExpress Converter which does the cutting and zooming. I also want 6 different zoom levels. I've started so far with this command: convert example.jpg -crop 256x256 +gravity -set filename:tile ./tiles/%[fx:page.x/256]-%[fx:page.y/256] %[filename:tile].jpg This produces a lot of x-y.jpg tiles.I don't know how i

Combine two single-channel TIFF stacks to a single multi-channel stack

ⅰ亾dé卋堺 提交于 2019-12-13 12:40:14
问题 I've got two tiff stacks with time-lapse data corresponding to different channels acquired in a microscopy experiment. I'd like to merge them into a single stack with two channels. Both stacks are 16-bit greyscale. When I use: convert stack1.tiff stack2.tiff stack_merged.tiff I get a single but concatenated file with two stacks one after another. Links to file 1 and file 2. 回答1: I think you need something like this: #!/bin/bash # Get index of last frame in TIFF image last=$(convert stack1.tif

Status code 422 Unprocessable Entity - Paperclip, ImageMagick & Rails 3

蹲街弑〆低调 提交于 2019-12-13 12:21:48
问题 I am not sure what's causing this and would love some insight: Started POST "/uploads.js" for 127.0.0.1 at 2011-02-21 09:14:36 -0500 Processing by UploadsController#create as JS Parameters: {"name"=>"DSC_0561.JPG", "chunk"=>"0", "chunks"=>"1", "upload"=>{"stage_id"=>"16"}, "authenticity_token"=>"SfNGZm4lP56eG94OliSo2Kk9Tikg+X2pHaGoRLdbUmg=", "file"=>#<ActionDispatch::Http::UploadedFile:0x000001080f7ce8 @original_filename="DSC_0561.JPG", @content_type="application/octet-stream", @headers=

imagemagick convert CMYK pdf to RGB jpeg or PNG and preseerve colors

佐手、 提交于 2019-12-13 11:34:05
问题 I have a cmyk pdf that I am trying to convert to a RGB jpeg or png file but have the colors stay pretty close to what the CMYK version is (compared to how photoshop does it) I am trying the following command but the colors change drastically from a red color to almost bright neon red and so on. Here is the command convert cmykpdf.pdf +profile icc -profile AdobeRGB1998.icc -colorspace sRGB jpegtesting.jpg Any ideas? or thoughts on how to do this. I tried saving it as a PNG also and same issue

GraphicsMagick getting “Stream yields empty buffer error” on Elastic Beanstalk

孤街醉人 提交于 2019-12-13 07:11:50
问题 I am using GM for very simple thing: drawing a circle and put it in buffer. But after I check the code into Elastic Beanstalk, I am getting the "Stream yields empty buffer error" error. I am not sure why because it totally works on localhost. Here is the code: gm(200, 200, '#FF0000') .setFormat('png') .fill('#00FF00') .drawCircle( 50, 50, 60, 60 ) .toBuffer(function( error, buffer ) { if( error ) { res.send("error:"+error+" with content length:"+data.ContentLength);} res.writeHead(200, {

Node.js find blob on image using connected components

不羁的心 提交于 2019-12-13 07:04:57
问题 I am trying to x y coordinates of blobs in an image. Following suggestions from this question:Connected-component labeling with ImageMagick I have this piece of code. The end result correctly highlights the blobs. However, I am unable to get the "verbose" output programmatically. I need the x y coordinates. AM I missing something? gm('difference.png') .out('-colorspace') .out('gray') .out('-threshold') .out('90%') .out('-define') .out('connected-components:verbose=true') .out('-connected

Convert command not working in windows

北城以北 提交于 2019-12-13 06:17:29
问题 Installed ImageMagick-7.0.4-7-Q16-x64-dll.exe for resolving the issue of Tesseract facing problems with smaller font explained in this Stackoverflow question Is there any way to improve tesseract OCR with small fonts? I ran the following convert command. But it still says invalid parameter. C:\Users\rt\Desktop\Sample_Files>convert -resize 400% image5.jpg image5out.jpg Invalid Parameter - 400% and when I ran this C:\Users\rt\Desktop\Sample_Files>where convert.exe C:\Windows\System32\convert

where can I find “imagick.so” for for ImageMagick 6.9.0.0 x86_64?

只谈情不闲聊 提交于 2019-12-13 05:29:40
问题 I am not a Linux User. I recently install ImageMagick on a CentOS via this tutorial: https://www.vultr.com/docs/install-imagemagick-on-centos-6 Seems everything installed normally... But After install,It seems I do not have "imagick.so" in my server... I got this error with ' php -m | grep imagick ' command: PHP warning: PHP Startup: Unable to load dynamic liberary '/usr/local/php54/lib/php/extentions/no-debug-non-zts-20100525/imagick.so: cannot open shared object file: No such file or

ImageMagick: Why won't this text expand to fill?

大憨熊 提交于 2019-12-13 05:07:23
问题 I'm reading the text handling docs for label and it seems if I specify -size it should magically get as big as possible to fill the space. I want to make it so this text gets as big as possible. I will set the \n characters myself in the title (if absolutely necessary). I'd rather the \n get calculated automatically, but it seems label is what makes it the biggest possible (but doesn't support automatic \n ), while caption will add \n where appropriate (but doesn't support a dynamic size