Server IP : 103.119.228.120 / Your IP : 18.217.98.175 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/ImageMagick-perl-6.9.10.68/demo/ |
Upload File : |
#!/usr/bin/perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell # # Demonstration of some of the fancier Image Composition Methods # including the 'rotate' parameter specific to PerlMagick Composite() # # NOTE: versions of IM older than IM v6.5.3-4 will need to rename the # parameter "args=>" to the mis-named "blend=>" parameter. # # Also not that "composite -watermark" is actually known as the compose # method "Modulate". # # Essentually each image is equivelent to # convert logo: -crop 80x80+140+60 +repage \ # -size 60x60 gradient:black-white \ # -alpha set miff:- |\ # composite - -geometry +10+10 -virtual-pixel gray \ # -dissolve 70x30 show: # for various composition methods. # use strict; use Image::Magick; # Background or Destination image my $dest=Image::Magick->new(); $dest->Read('logo:'); $dest->Crop('100x100+400+100'); # wizards hat $dest->Set(page=>'0x0+0+0'); $dest->Set(alpha=>'Set'); # Source, Composite or Overlay image my $src=Image::Magick->new(); $src->Set(size=>'80x80'); $src->Read('gradient:black-white'); $src->Set(alpha=>'Set'); my $offset="+10+10"; # Circle Mask Image (same size as Destination) my $circle=Image::Magick->new(); $circle->Set(size=>'80x80'); $circle->Read('xc:black'); $circle->Draw(fill=>'white',primitive=>'circle',points=>'39.5,39.5 10,39.5'); my $texture=Image::Magick->new(); $texture->Read('pattern:checkerboard'); # List of images generated my $results=Image::Magick->new(); # Working copy of Destination Image my $clone; # ---------------------------------------- # Normal Composition Methods $clone=$dest->Clone(); $clone->Label('Over\n(normal compose)'); $clone->Composite( image=>$src, compose=>'over', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Multiply\n(add black)'); $clone->Composite( image=>$src, compose=>'multiply', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Screen\n(add white)'); $clone->Composite( image=>$src, compose=>'screen', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('HardLight\n(light effects)'); $clone->Composite( image=>$src, compose=>'hardlight', geometry=>$offset, ); push(@$results, $clone); # --------------- # Masked and Blending Demonstartion $clone=$dest->Clone(); $clone->Label('Circle Masked\n(three image)'); $clone->Composite( image=>$src, mask=>$circle, compose=>'over', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Blend 50x50\n(50% plus 50%)'); $clone->Composite( image=>$src, compose=>'blend', args=>'50x50', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Dissolve 50x50\n(50% over 50%)'); $clone->Composite( image=>$src, compose=>'dissolve', args=>'50x50', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Dissolve 50\n(50% over 100%)'); $clone->Composite( image=>$src, compose=>'dissolve', args=>'50', geometry=>$offset, ); push(@$results, $clone); # --------------- # Displacement Demonstartion $clone=$dest->Clone(); $clone->Label('Displace 50x0\n(displace horiz)'); $clone->Set('virtual-pixel'=>'gray'); $clone->Composite( image=>$src, compose=>'displace', args=>'50x0', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Displace 0x50\n(compress vert)'); $clone->Set('virtual-pixel'=>'gray'); $clone->Composite( image=>$src, compose=>'displace', args=>'0x50', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Displace 50x50\n(diagonal)'); $clone->Set('virtual-pixel'=>'gray'); $clone->Composite( image=>$src, compose=>'displace', args=>'50x50', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Displace 0,-80\n(displace flip)'); $clone->Set('virtual-pixel'=>'gray'); $clone->Composite( image=>$src, compose=>'displace', args=>'0,-80', geometry=>$offset, ); push(@$results, $clone); # --------------- # Demonstrate rotation # note that offset is automatically adjusted to keep rotated image # centered relative to its '0' rotation position $clone=$dest->Clone(); $clone->Label('Rotate 0\n'); $clone->Composite( image=>$src, compose=>'over', rotate=>0, background=>'none', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Rotate 10\n'); $clone->Composite( image=>$src, compose=>'over', rotate=>10, background=>'none', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Rotate 45\n'); $clone->Composite( image=>$src, compose=>'over', rotate=>45, background=>'none', geometry=>$offset, ); push(@$results, $clone); $clone=$dest->Clone(); $clone->Label('Rotate 90\n'); $clone->Composite( image=>$src, compose=>'over', rotate=>90, background=>'none', geometry=>$offset, ); push(@$results, $clone); # ---------------------------------------- # Output the changed pixels # to every image underlay a checkboard pattern # so as to show if any transparency is present for my $image ( @$results ) { $image->Composite( image=>$texture, tile=>'True', compose=>'DstOver', ); } my $montage=$results->Montage( geometry=>'+10+10', tile=>'4x', frame=>'6x6+2+2', shadow=>'True', ); $montage->Write('show:'); $montage->Write('compose_specials.jpg');