项目中需要实现一些图片文件到TIFF文件的转换,去网上下载了一些第三方软件。

好的软件需要收费,免费的存在各种问题。

自己动手,丰衣足食!

众里寻他千百度,蓦然回首,那人就是ImageMagick。

官网链接:http://www.imagemagick.org/script/index.php

ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over ) including PNG, JPEG, JPEG-, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

以上的话引用自官网,强大的让人心跳,而且是开源的!感谢开源!感谢Linux!

一、下载源码。

二、执行./configure,发现不支持PDF转换,缺少库的支持。

. pdf库:ftp://ftp.gnu.org/gnu/ghostscript
. 编译pdf库,提示lcms版本过旧
. lcms库:http://www.littlecms.com/index.html
. 编译lcms2库,通过。
. 编译pdf库,通过。 一个小插曲:ghostscript编译不出so文件。
解决办法:make so && make soinstall,搞定。

三、后来发现一个更棒的下载依赖库的地方。

http://www.imagemagick.org/download/delegates/

这是官网提供的库。

四、重新./configure,编译,安装。

 Delegate Library Configuration:
BZLIB --with-bzlib=yes no
Autotrace --with-autotrace=no no
DJVU --with-djvu=yes no
DPS --with-dps=yes no
FFTW --with-fftw=yes no
FlashPIX --with-fpx=yes no
FontConfig --with-fontconfig=yes no
FreeType --with-freetype=yes yes
Ghostscript lib --with-gslib=no no
Graphviz --with-gvc=yes no
JBIG --with-jbig=yes no
JPEG v1 --with-jpeg=yes yes
LCMS --with-lcms=yes no
LQR --with-lqr=yes no
LTDL --with-ltdl=yes no
LZMA --with-lzma=yes no
Magick++ --with-magick-plus-plus=yes yes
OpenEXR --with-openexr=yes no
OpenJP2 --with-openjp2=yes no
PANGO --with-pango=yes no
PERL --with-perl=no no
PNG --with-png=yes yes
RAQM --with-raqm=yes no
RSVG --with-rsvg=no no
TIFF --with-tiff=yes yes
WEBP --with-webp=yes no
WMF --with-wmf=yes no
X11 --with-x= yes
XML --with-xml=yes yes
ZLIB --with-zlib=yes yes

configure执行完毕,大致看到这样的信息,yes就意味着已经支持的文件或者库格式。

no就是缺少相关库的支持或者信息,还有一个原因,编译开关未打开。

例如安装gslib库以后,./configure --with-gslib才能增加对pdf的处理支持。

五、简单的测试。

convert apple.jpg apple.png

这就实现了jpg图片到png图片格式的转换!

对于非图像领域的工作者来讲,能这样转换就足够了。

图片格式转换之ImageMagick的更多相关文章

  1. 【VC++技术杂谈007】使用GDI+进行图片格式转换

    本文主要介绍如何使用GDI+对图片进行格式转换,可以转换的图片格式为bmp.jpg.png. 1.加载GDI+库 GDI+是GDI图形库的一个增强版本,提供了一系列Visual C++ API.为了使 ...

  2. python 将png图片格式转换生成gif动画

    先看知乎上面的一个连接 用Python写过哪些[脑洞大开]的小工具? https://www.zhihu.com/question/33646570/answer/157806339 这个哥们通过爬气 ...

  3. bmp,jpg,png,tif,wmf,emf与eps图片格式转换

    wmf/emf是两种Microsoft Windows的图形文件格式.它是一个矢量图格式,但是也允许包含位图.本质上,一个WMF文件保存一系列可以用来重建图片的Windows GDI命令.在某种程度上 ...

  4. 利用PBFunc在Powerbuilder中进行图片格式转换

    利用PBFunc的n_pbfunc_image对象可以方便的进行图片格式的转换与大小转换 支持相互转换的格式有以下几种: FORMAT_BMP //bmp格式FORMAT_GIF  //gif格式FO ...

  5. php 图片格式转换-亲测ok

    代码如下 /** * 图片格式转换 * @param string $image_path 文件路径或url * @param string $to_ext 待转格式,支持png,gif,jpeg,w ...

  6. MAC图片格式转换

    OS X下有一个sips的程序可以用来处理图片. sips的名称功能非常强大,参考 帮助文档 . 这里我们只用到其中的一个功能,转换图片格式. 命令参考: sips  - s format jpeg  ...

  7. 关于PHP批量图片格式转换的问题--本文转成webp, 其他过程格式一样

    最近要把项目中的图片全部生成webp格式, 过程整理一下,    (直接存在本地,或者图片链接存在数据库都可以看看) 首先,肯定是批量处理, 一个php处理不了这么多, 会爆内存的, 个人建议用aja ...

  8. PIL图片格式转换

    PIL格式转换 原图: #!/usr/local/bin/python # -*- coding: utf8 -*- from PIL import Image, ImageFilter import ...

  9. 自己积累的一些Emgu CV代码(主要有图片格式转换,图片裁剪,图片翻转,图片旋转和图片平移等功能)

    using System; using System.Drawing; using Emgu.CV; using Emgu.CV.CvEnum; using Emgu.CV.Structure; na ...

随机推荐

  1. C#学习总结~~~

    0.和java很相似, struct(结构) 实例化出来的对象,是在内存栈中分配: class(类)实例化出来的对象,指向了内存堆中分配的空间:  string.object.class,这3个引用类 ...

  2. 【crunch bang】 增加“菜单项”

    [右键菜单]->[Settings]->[Openbox]->[GUI Menu Editor] 挑选合适的位置,增加[菜单项],编辑内容.

  3. android之‘com.example.android.apis.view’的代码段

    1.AutoCompleteTextView ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, and ...

  4. Android_adb详解

    adb定义:adb(android debug bridge)是android系统中的一种命令行工具,通过它可以和android设备或模拟器通信. adb工具位置: <path-to-sdk&g ...

  5. OpenStack 镜像制作之cloud-init

    Contents [hide] 1 背景 2 密钥登录 2.1 密钥登录的原理 2.1.1 openstack的私钥 2.1.2 密码注入 = 2.1.3 实际遇到的情况 2.1.4 解决办法 背景 ...

  6. autohotkey-【GUI】Switch between Windows of the Same Application

    下面给出了ahk的脚本,但我需要GUI http://superuser.com/questions/435602/shortcut-in-windows-7-to-switch-between-sa ...

  7. Android 标签的主题样式

    Android平台定义的主题样式: android:theme="@android:style/Theme.Dialog"   将一个Activity显示为对话框模式 •andro ...

  8. 【转载】perl接受传递参数的方法

    #! /usr/bin/perl use Getopt::Std;use warnings;use strict; sub read_from_sh($) { my $file = shift; my ...

  9. Table Properties [AX 2012]

    Table Properties [AX 2012] 1 out of 2 rated this helpful - Rate this topic Updated: July 20, 2012 Ap ...

  10. org.hibernate.TransientObjectException

    使用JPA注解@ManyToMany做一个多对多的用例. 为了避免在删除主表数据时同时级联删除从表数据,JPA官方文档建议在主表的从表字段使用级联注解:CascadeType.PERSIST,Casc ...