如何将Image :: Magick包装成PAR(perl)?

时间:2012-10-25 07:01:42

标签: perl

ImageMagick下载
http://www.imagemagick.org/script/binary-releases.php#windows

C:\ Program Files(x86)\ ImageMagick-6.8.0-Q16
在所有Dll副本中 * .dll

use strict;
use warnings;
my $l;
my @dll=glob "*.dll";
$l.=" -l $_" foreach(@dll);
#print $l;
print `pp -v -o ss.exe$l img.pl`;

运行image.exe
SUCESS !!!!

我也试试gm.exe

谢谢人

=============================================== ==================================

image.exe(双击)完成不会创建k.jpg
请告诉我如何解决

perl pp.pl - >创建“image.exe”

perl image.pl - >创造k.jpg
image.exe(双击) - >无法创建k.jpg

image.pl

use strict;
use warnings;
use Image::Magick;
my $img=Image::Magick->new;
$img->Read('s.bmp');
$img->Write('k.jpg');

pp.pl

use strict;
use warnings;
my $l;
my @dll=glob "*.dll";
$l.=" -l $_" foreach(@dll);
print $l;
print `pp -v -o image.exe$l -M Image::Magick image.pl`;

请告诉我如何启动Imagemagick PAR

== dll列表==

-l analyze.dll -l atl100.dll -l CORE_RL_bzlib_.dll -l CORE_RL_coders_.dll -l CO
RE_RL_filters_.dll -l CORE_RL_jbig_.dll -l CORE_RL_jp2_.dll -l CORE_RL_jpeg_.dll
 -l CORE_RL_lcms_.dll -l CORE_RL_libxml_.dll -l CORE_RL_Magick++_.dll -l CORE_RL
_magick_.dll -l CORE_RL_png_.dll -l CORE_RL_tiff_.dll -l CORE_RL_ttf_.dll -l COR
E_RL_wand_.dll -l CORE_RL_xlib_.dll -l CORE_RL_zlib_.dll -l IM_MOD_RL_aai_.dll -
l IM_MOD_RL_art_.dll -l IM_MOD_RL_avs_.dll -l IM_MOD_RL_bgr_.dll -l IM_MOD_RL_bm
p_.dll -l IM_MOD_RL_braille_.dll -l IM_MOD_RL_cals_.dll -l IM_MOD_RL_caption_.dl
l -l IM_MOD_RL_cin_.dll -l IM_MOD_RL_cip_.dll -l IM_MOD_RL_clip_.dll -l IM_MOD_R
L_clipboard_.dll -l IM_MOD_RL_cmyk_.dll -l IM_MOD_RL_cut_.dll -l IM_MOD_RL_dcm_.
dll -l IM_MOD_RL_dds_.dll -l IM_MOD_RL_debug_.dll -l IM_MOD_RL_dib_.dll -l IM_MO
D_RL_djvu_.dll -l IM_MOD_RL_dng_.dll -l IM_MOD_RL_dot_.dll -l IM_MOD_RL_dps_.dll
 -l IM_MOD_RL_dpx_.dll -l IM_MOD_RL_emf_.dll -l IM_MOD_RL_ept_.dll -l IM_MOD_RL_
exr_.dll -l IM_MOD_RL_fax_.dll -l IM_MOD_RL_fd_.dll -l IM_MOD_RL_fits_.dll -l IM
_MOD_RL_fpx_.dll -l IM_MOD_RL_gif_.dll -l IM_MOD_RL_gradient_.dll -l IM_MOD_RL_g
ray_.dll -l IM_MOD_RL_hald_.dll -l IM_MOD_RL_hdr_.dll -l IM_MOD_RL_histogram_.dl
l -l IM_MOD_RL_hrz_.dll -l IM_MOD_RL_html_.dll -l IM_MOD_RL_icon_.dll -l IM_MOD_
RL_info_.dll -l IM_MOD_RL_inline_.dll -l IM_MOD_RL_ipl_.dll -l IM_MOD_RL_jbig_.d
ll -l IM_MOD_RL_jnx_.dll -l IM_MOD_RL_jp2_.dll -l IM_MOD_RL_jpeg_.dll -l IM_MOD_
RL_label_.dll -l IM_MOD_RL_mac_.dll -l IM_MOD_RL_magick_.dll -l IM_MOD_RL_map_.d
ll -l IM_MOD_RL_mat_.dll -l IM_MOD_RL_matte_.dll -l IM_MOD_RL_meta_.dll -l IM_MO
D_RL_miff_.dll -l IM_MOD_RL_mono_.dll -l IM_MOD_RL_mpc_.dll -l IM_MOD_RL_mpeg_.d
ll -l IM_MOD_RL_mpr_.dll -l IM_MOD_RL_msl_.dll -l IM_MOD_RL_mtv_.dll -l IM_MOD_R
L_mvg_.dll -l IM_MOD_RL_null_.dll -l IM_MOD_RL_otb_.dll -l IM_MOD_RL_palm_.dll -
l IM_MOD_RL_pango_.dll -l IM_MOD_RL_pattern_.dll -l IM_MOD_RL_pcd_.dll -l IM_MOD
_RL_pcl_.dll -l IM_MOD_RL_pcx_.dll -l IM_MOD_RL_pdb_.dll -l IM_MOD_RL_pdf_.dll -
l IM_MOD_RL_pes_.dll -l IM_MOD_RL_pict_.dll -l IM_MOD_RL_pix_.dll -l IM_MOD_RL_p
lasma_.dll -l IM_MOD_RL_png_.dll -l IM_MOD_RL_pnm_.dll -l IM_MOD_RL_preview_.dll
 -l IM_MOD_RL_ps2_.dll -l IM_MOD_RL_ps3_.dll -l IM_MOD_RL_ps_.dll -l IM_MOD_RL_p
sd_.dll -l IM_MOD_RL_pwp_.dll -l IM_MOD_RL_raw_.dll -l IM_MOD_RL_rgb_.dll -l IM_
MOD_RL_rla_.dll -l IM_MOD_RL_rle_.dll -l IM_MOD_RL_scr_.dll -l IM_MOD_RL_sct_.dl
l -l IM_MOD_RL_sfw_.dll -l IM_MOD_RL_sgi_.dll -l IM_MOD_RL_stegano_.dll -l IM_MO
D_RL_sun_.dll -l IM_MOD_RL_svg_.dll -l IM_MOD_RL_tga_.dll -l IM_MOD_RL_thumbnail
_.dll -l IM_MOD_RL_tiff_.dll -l IM_MOD_RL_tile_.dll -l IM_MOD_RL_tim_.dll -l IM_
MOD_RL_ttf_.dll -l IM_MOD_RL_txt_.dll -l IM_MOD_RL_uil_.dll -l IM_MOD_RL_url_.dl
l -l IM_MOD_RL_uyvy_.dll -l IM_MOD_RL_vicar_.dll -l IM_MOD_RL_vid_.dll -l IM_MOD
_RL_viff_.dll -l IM_MOD_RL_wbmp_.dll -l IM_MOD_RL_webp_.dll -l IM_MOD_RL_wmf_.dl
l -l IM_MOD_RL_wpg_.dll -l IM_MOD_RL_x_.dll -l IM_MOD_RL_xbm_.dll -l IM_MOD_RL_x
c_.dll -l IM_MOD_RL_xcf_.dll -l IM_MOD_RL_xpm_.dll -l IM_MOD_RL_xps_.dll -l IM_M
OD_RL_xtrn_.dll -l IM_MOD_RL_xwd_.dll -l IM_MOD_RL_ycbcr_.dll -l IM_MOD_RL_yuv_.
dll -l mfc100.dll -l msvcp100.dll -l msvcr100.dll -l vcomp100.dll -l X11.dll -l
Xext.dll

1 个答案:

答案 0 :(得分:0)

我想你想要的只是具有从BMP转换为JPG的实用程序? 在这种情况下,我建议简单地获得静态编译版本的ImageMagick convert.exe 或GraphicsMagick gm.exe (你可以得到它here)并捆绑它在您的应用内部或旁边。 然后你可以根据需要将它称为外部实用程序,并完全避免这些链接问题(我认为这几乎是DLL地狱)。

编辑:说明如何让静态gm.exe正常工作。下载并安装GraphicsMagick-1.2.5-Q16-windows-static.exe。安装完成后,在其安装目录中找到 gm.exe 并复制到您自己的目录(如perl脚本)。现在您可以卸载GraphicsMagick - gm.exe 就是您所需要的。

现在,当您需要将BMP转换为JPG时,只需将其调用为:

 system("gm convert file.bmp file.jpg");

如果需要,您还应该能够将gm.exe捆绑到PAR文件中。