SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
DESIGN AND DEVELOPMENT



                                           Image Magic for PowerBuilder
                                           A Free Software Package For Easy Image Manipulations
                                           Using PowerBuilder

                                           By Marco Cimaroli




                                           S
                                                   ix months ago, I was work-             the key features for ImageMagick/Pow-
                                                   ing with my team on a soft-            erBuilder integration. Some of these
                                                   ware project for an enterprise         features include:
                                           customer on a tool to manage salesman
                                           ‘in store merchandising visitation’ . Our      1.) The ‘Identify’ method to retrieve
                                           development tools were PowerBuilder                the properties image.
                                           10.5 and SQLAnywhere 10. For this
                                           project, we had a particular require-          2.) The ‘Convert’ method to:
                                           ment to convert and show TIFF images               • Re-size an image by a percent.
                                           inside the application using a free                • Re-size an image by a fixed size.
                                           image library.                                     • Superimpose text over an exist-
                                                After some google searching, I                   ing image.
                                           discovered an image library called ‘Ima-           • Create text images from scratch.
                                           geMagick’ that allowed us to convert               • Create a JPEG from a PDF file.
                                           TIFF files on the fly from PowerScript.            • Crop a selection of an image.
                                           ImageMagick (www.imagemagick.
                                           org) is a free software suite that is          3.) The ‘Mogrify’ method to create
                                           distributed with a GPL compatible                  thumbnails folders.
                                           license. It offer several interfaces such as
                                           C lib, Dll, COM library and a com-             4.) The ‘Montage’ method to create an
                                           mand line converter tool to transform              image index from selected thumb-
                                           images.                                            nails.
                                                Obviously, it doesn’t reach a full
                                           integration with PowerBuilder like             The ImageMagick Setup
                                           some professional image tools (i.e.            The first thing to do is to download
Marco Cimaroli is a registered Gold        Pegasus, Lead-Tools) delivered as              ImageMagick (www.imagemagick.
ISUG member who works at Selda             Activex, but it’s free, and it allowed us      org) and to choose the Windows setup.
Informatica, an Italian software company   to easily manipulate many images using         The current version is ImageMagick-
located in Ascoli Piceno (Marche,Italy).   PowerBuilder objects. Some of these            6.5.9-0-Q16-windows-dll.exe.exe.
Marco has used Sybase technology since     manipulations include picture control,         Run the setup following the setup
1994, starting with PowerBuilder 4.0
and Watcom SQL. Currently, Marco is
                                           DataWindow picture control and                 wizard panels. It is important to have
using PowerBuilder 11.5,PocketBuilder      bitmap computed columns.                       ‘administrator’ rights and to check the
2.5, and SQLAnywhere 11 on various              For this article, I have created a        ‘ImageMagick OLE control’ option.
platforms.                                 PowerBuilder 11 example applica-               After setup completion, it’s possible to
                                           tion, and I have used both the COM             verify that environment variables are
                                           interface and the “montage” console            set correctly simply by calling the fol-
                                           command to help explain the some of            lowing commands from CMD session:

10     ISUG TECHNICAL JOURNAL
IMAGE MAGIC FOR POWERBUILDER




 co n v e rt l o g o : l o g o. m iff                                             The Convert Method
 imdi s pl ay l o g o .m iff                                                      The ‘Convert’ method is quite powerful as it provides the
                                                                                  modification functionality that is necessary for changing
                                    If the installation was suc-                  an image’s format, re-sizing an image, blurring an image,
                                    cessful, the ImageMagick                      cropping an image, flipping an image, joining an image, and
                                    picture will be showed as                     drawing on an existing image as well as much more.
                                    in Figure 1. All of the
                                    ImageMagick methods that                      Re-sizing An Image By A Percentage
                                    I’ll be covering in this article              If we want to convert the size of an image by a percentage,
                                    are stored in a PowerBuilder                  we invoke the ‘Convert’ method passing it a source image, a
                                    non-visual object called                      destination image and re-size factor to apply to the original
     Figure 1: ImageMagick           n_nvo_magick. This object                    image. For example passing a re-size factor of 50, we obtain
                                     is used as a service object                  a new image with reduced size of 50%. The syntax for this
to call the ImageMagick API. I also use some structures to                        conversion is as follows:
store image attributes as well as two DataWindows to display                       iole_ img . Conver t ( Ò -r esize Ó , st r ing (per c-r esize) + Ó % Ó ,
both the full image and the thumbnails. Within the COM                                 a s_ fr om_ ima g e, a s_ t o_ ima g e)
interface, the connection to the COM server is identified by
‘ImageMagickObject.MagickImage.1’ class name. If you have                         The method requires four arguments: ‘-resize’ command,
problems connecting to the OLE Server, you need to register                       percentage value, source image, and destination image. The
the ImageMagickObject.dll manually using the command:                             convert method returns a ‘any’ value containing 3 comma
regsvr32 /c /s <installation path>ImageMagickObject.dll .                        separated parameters containing the width, the height and
                                                                                  the type of the new image. This can be useful information
The Identify Method                                                               that we can reuse inside our code.
To extract the information from the image via the Image-                             Note : One particularity of ImageMagick is that it
Magick’s ‘Identify’ method, you will need to provide three                           creates a new image on the hard disk for each image
arguments : an identification option, an attribute mask and                          transformation.
an image filename. The syntax for the ‘Identify’ method is
below:                                                                            Re-sizing An Image By A Fixed Size
                                                                                  We can also use the ‘Convert’ method with the ‘-resize’ com-
 iol e _i m g .I de n t i fy ( a s _ id _ ty p e, Ò %w, %h, %b , %f,% c,% g Ó ,
                                                                                  mand passing it the source and destination images and new
      as _i m g _f i l e )
                                                                                  fixed dimension for the width and/or height to apply to the
The iole_img is the OleObject variable that is connected to                       original image. For example, if pass only a new width dimen-
ImageMagick OleServer. Using the ‘-format ‘ identification                        sion of 200 pixels, you obtain a new thumbnail image with
type we can obtain some important information as specified                        a max width of 200 pixels and a new relative proportional
by the above attribute mask such that:                                            height. This method also requires four arguments: ‘-resize’
    • %w returns the width                                                        command, a new width (as_dim = “200”), source image, and
    • %h returns the height                                                       destination image. The syntax for the method is:
    • %b returns the filesize
                                                                                   iole_ img . Conver t ( Ò -r esize Ó , a s_ d im, a s_ fr om_i mage,
    • %f returns the filename
                                                                                       a s_ t o_ ima g e)
    • %c returns the image comment
    • %g returns the page geometry                                                Superimpose Text Over An Existing Image
                                                                                  We can also use the ‘Convert’ method to draw graphic text
For a detailed list of possible ‘-format’ arguments you can see                   on existing image. To do so, we use the ‘Convert’ method
http://www.imagemagick.org/script/escape.php web page .                           with a direct call to the convert.exe program, passing along all
The width and height are expressed in pixels and they are                         the arguments it requires. To run it with a synchronous call,
our starting point for calculating the dimensions in PbUnits,                     we make use of the uo_syncproc Pb object from topwizpro-
thereby, allowing us to correctly display our source image on                     gramming . However, all the work is done by n_nvo_magick
a DataWindow computed bitmap column.                                              with the following method:

                                                                                                                                  FEBRUARY 2010               11
IMAGE MAGIC FOR POWERBUILDER




 n _n v o _m ag i c k .of_ im g _ d r a w_ tex t (                             as_fill_color - color name to fill the text.
     s t ri n g as _f ro m _ im a g e, s tr in g a s _ to_ im a g e,           as_stroke_color - color name for the stroke of text.
     l o n g al _x _pos , lon g a l_ y _ p os ,                                as_text - the text to draw inside the image.
     s t ri n g as _f o n t_ n a m e, lon g a l_ p oin t_ s iz e,
     s t ri n g as _f i ll_ color , s tr in g a s _ s tr ok e_ colo r ,
                                                                           In my example application, I have created an image displaying
     s t ri n g as _t e x t)
                                                                           the text ‘PowerBuilder 11’ shown below in Figure 3.
The above method requires the caller to pass the source
image path, the destination image path, the x position in
pixels, the y position in pixels, the desired font name , the                            Figure 3: Text Image From Scratch
point size, the fill color, the stroke color, and the desired text
                                                                           Create An Image From A PDF File
to be drawn. For example, if I call the method with :
                                                                           This function is similar to the other ‘Convert’ options we
 n _n v o _m ag i c k .of_ im g _ d r a w_ tex t ( ls _ fr om _ ima g e,   have already seen with the only difference being that the
      l s _t o _i m ag e , 1 0 , 30 , Ô T ha om a Õ , 2 4 ,                source file is not an image but a PDF file. The method to use
    Ô W h i t e Ô , Õ W h i te Õ , Ô C hies a d i Sa n Fr a n ces co ,     is as follows:
      A s c o l i P i c e n o - I ta lia Õ )
                                                                            n_ nvo_ ma g ick. of_ img _ conver t _ pd f (
                                                                               st r ing a s_ fr om_ ima g e, st r ing a s_ t o_ ima g e,
The following text drawn will be drawn on my image which
                                                                               boolea n a b_ one_ ima g e)
is shown below in Figure 2.
                                                                           To do the conversion, the caller must supply the name of
                                                                           PDF file to convert, the name of the destination image and a
                                                                           switch to force the composition of one PDF file when Image-
                                                                           Magick produces more JPEGs from the PDF source file.

                                                                           Crop A Selection Of A Source Image
                                                                           Cropping an image is a familiar operation that everyone uses
                Figure 2: Image With Annotation                            to obtain a new image by selecting a portion of an original
Create A Text Image From Scratch                                           image and deleting the rest. The method to call to crop an
Using the ‘Convert’ method withthis option allows you to                   image is:
create a new image from scratch adding a graphic text to                   n_ nv nvo_ ma g ick. of_ img _ cr op (
display inside it. The signature for the method is as follows:                st r ing a s_ fr om_ ima g e, st r ing a s_ t o_ ima g e,
                                                                              long a l_ w id t h, long a l_ heig ht , long a l_ x_ pos,
 n _n v o _m ag i c k .of_ im g _ tex t_ fr om _ s cr a tch (
                                                                              long a l_ y_ pos)
     s t ri n g as _t o _ im a g e, lon g a l_ wid th_ s iz e,
     l o n g al _h e i g ht_ s iz e, s tr in g a s _ b a ck _ color ,      You need to pass it the name of the source image, the name
     l o n g al _x _pos , lon g a l_ y _ p os ,
                                                                           of the destination image, the width and height of the area to
     s t ri n g as _f o n t_ n a m e, lon g a l_ p oin t_ s iz e,
                                                                           crop, and the coordinate of the top left corner of the area. I
     s t ri n g as _f i ll_ color , s tr in g a s _ s tr ok e_ colo r ,
                                                                           have used a floating DataWindow rectangle (See Figure 4
     s t ri n g as _t e x t)
                                                                           and 5) to dynamically show the cropping area to select .
The arguments to pass it are the following:
  as_to_image - name of the destination image.
  al_width_size - width in pixels.
  al_height_size - height in pixels.
  as_back_color - name of the background color.
  al_x_pos - x coordinate of the text starting point.
  al_y_pos - y coordinate of the text starting point.
  as_font_name - name of the font to use.                                                                                Figure 5: Result Of
  al_point_size - size of the font.                                          Figure 4: Crop Area Selection               Crop Operation

12       ISUG TECHNICAL JOURNAL
IMAGE MAGIC FOR POWERBUILDER




The Mogrify Method                                                                     st r ing a s_ ba ckg r ound _ color , st r ing a s_ g eo metry,
 With the ‘Convert’ re-sizing commands, we have seen how                               int eg er a i_ t ile_ col_ num, int eg er a i_ t ile_ r ow_nu m,
to create a thumbnail image starting from the original image.                          boolea n a b_ pola r oid , st r ing a s_ ima g e_ ba ckc ol or,
Now we will discover the ‘Mogrify’ command that allows us                              boolea n a b_ a d d _ t it le, st r ing a s_ t it le,
to create many thumbnails at once . For this purpose, I have                           st r ing a s_ t it le_ font , st r ing a s_ t it le_ point si z e)
implemented the following method:                                                  This method needs the following arguments:
 n _n v o _m ag i c k .o f_ im g _ cr ea te_ fold er _ thu m b s(                     as_ini_folder - folder path containing thumbnails.
     s t ri n g as _s o u r ce_ p a th,                                               as_dest_folder - destination folder path.
     s t ri n g as _i m a g e_ ex ten s ion ,                                         as_source_images - array of selected thumbnails.




                                                                                                                                                                 DESIGN AND DEVELOPMENT
     s t ri n g as _o u tp u t_ p a th, s tr in g a s _ ou tp u t_ f or ma t ,        as_dest_image - name of the new image.
     l o n g al _t h umb _ wid th, lon g a l_ thu m b _ height ,                      ai_thumb_width - width of the thumbnails.
     re f s t _i m g _a ttr ib a s _ im g _ a r r a y [ ] )                           ai_thumb_height - height of the thumbnails.
                                                                                      as_border_color - image border color.
It requires the followings arguments:
                                                                                      as_background_color - image background color.
     as_source_path - complete path of the folder that
                                                                                      as_geometry - geometry that specifies spaces be-
     contains original images.
                                                                                      tween new image thumbnails.
     as_image_extension - image extension to convert.
                                                                                      ai_tile_col_num - number of columns to distribute
     as_output_path - complete path of the folder that
                                                                                      thumbnails inside the new image.
     will contain the thumbnails.
                                                                                      ai_tile_row_num - number of rows to distribute.
     as_output_format - output image type (e.g. bmp).
                                                                                      thumbnails inside the new image.
     al_thumb_width - width dimension (in pixels).
                                                                                      ab_polaroid - thumbnails’ polaroid effect switch.
     al_thumb_height - height dimension (in pixels).
                                                                                      as_image_backcolor - new background color.
     as_img_array[] - array of type stimg_attrib contain-
                                                                                      ab_add_title - title switch.
     ing thumbnails attributes.
                                                                                      as_title - title of the new image.
                                                                                      as_title_font - title font name (e.g. Arial).
                            In my example, I have
                                                                                      as_title_pointsize - title font size (e.g. 12).
                        selected c:temp as the source
                        folder, JPEG as the image
                                                                                                                        In my example, I have
                        extension , c:tempthumbs as
                                                                                                                        selected five images and
                        output folder , GIF as the output
                                                                                                                        I have obtained the new
                        type and 200x200 pixels as the
                                                                                                                        image as shown in Figure
                        thumbnails dimensions. After
                                                                                                                        6. It is a JPEG image with
                        the creation of the thumbnails,
                                                                                                                        3 columns, 2 rows, white
   Figure 5: Thumbnails I have used a DataWindow to                                                                     thumbnails border color ,
                        display thumbs on the screen as
                                                                                                                        gray thumbnails background
                        shown in Figure 5.
                                                                                     Figure 6: New Image                color, thumbnails with a
                                                                                     From Five Thumbnails               polaroid effect, white image
The Montage Method
                                                                                                                        background color and a
Lastly, I will explain how to create an image index as a collage
                                                                                                                        ‘ISUG index’ title .
of a collection of selected thumbnails using the ‘Montage’
method. To do this, I have first implemented a script to allow                     Conclusion
us to select thumbnails from the DataWindow container and                          I have finished with the explanation of the major features
then I have implemented the following method:                                      of the ImageMagick library. You can find other interesting
 n _n v o _m ag i c k .of_ im g _ m a k e_ m on ta g e (                           examples and the source code on the ISUG web site (www.
     s t ri n g as _i n i_ fold er , s tr in g a s _ d es t_ fold e r ,            isug.com). Some of these additional examples include raise,
     s t ri n g as _s o u r ce_ im a g es [ ] , s tr in g a s _ d es t_ ima g e,   blur, swirl, frame, polaroid and flip. Likewise, you can add
     i n t e g e r ai _t h u m b _ wid th,                                         other functionalities simply by reading the ImageMagick
     i n t e g e r ai _t h u m b _ heig ht, s tr in g a s _ b or d er _ color ,    documentation and writing them in PowerScript code.

                                                                                                                                FEBRUARY 2010               13

Mais conteúdo relacionado

Mais procurados

Augmented reality The future of computing
Augmented reality The future of computingAugmented reality The future of computing
Augmented reality The future of computingAbhishek Abhi
 
Recent Trends And Challenges In Augmented Reality
Recent Trends And Challenges In Augmented RealityRecent Trends And Challenges In Augmented Reality
Recent Trends And Challenges In Augmented Realitysaurabh kapoor
 
Golden Krishna – The Best Interface is No Interface
Golden Krishna – The Best Interface is No InterfaceGolden Krishna – The Best Interface is No Interface
Golden Krishna – The Best Interface is No InterfaceinUse
 
Userspots - Kullanılabilirlik Testleri
Userspots - Kullanılabilirlik TestleriUserspots - Kullanılabilirlik Testleri
Userspots - Kullanılabilirlik TestleriUserspots
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Developmentjini james
 
Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)
Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)
Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)Youssef Shehab
 
Introduction to Usability Testing: The DIY Approach - GA, London January 13th...
Introduction to Usability Testing: The DIY Approach - GA, London January 13th...Introduction to Usability Testing: The DIY Approach - GA, London January 13th...
Introduction to Usability Testing: The DIY Approach - GA, London January 13th...Evgenia (Jenny) Grinblo
 
Augmented And Virtual Reality
Augmented And Virtual Reality Augmented And Virtual Reality
Augmented And Virtual Reality Gabrielle Taruc
 
An introduction to mobile app development and investing
An introduction to mobile app development and investingAn introduction to mobile app development and investing
An introduction to mobile app development and investingBrandon Na
 

Mais procurados (12)

Augmented reality The future of computing
Augmented reality The future of computingAugmented reality The future of computing
Augmented reality The future of computing
 
Recent Trends And Challenges In Augmented Reality
Recent Trends And Challenges In Augmented RealityRecent Trends And Challenges In Augmented Reality
Recent Trends And Challenges In Augmented Reality
 
Golden Krishna – The Best Interface is No Interface
Golden Krishna – The Best Interface is No InterfaceGolden Krishna – The Best Interface is No Interface
Golden Krishna – The Best Interface is No Interface
 
Userspots - Kullanılabilirlik Testleri
Userspots - Kullanılabilirlik TestleriUserspots - Kullanılabilirlik Testleri
Userspots - Kullanılabilirlik Testleri
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
 
Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)
Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)
Egyptian Museum -by Augmented Reality- (Graduation Project Documentation)
 
Best practices for UI/UX in eCommerce
Best practices for UI/UX in eCommerceBest practices for UI/UX in eCommerce
Best practices for UI/UX in eCommerce
 
Introduction to Usability Testing: The DIY Approach - GA, London January 13th...
Introduction to Usability Testing: The DIY Approach - GA, London January 13th...Introduction to Usability Testing: The DIY Approach - GA, London January 13th...
Introduction to Usability Testing: The DIY Approach - GA, London January 13th...
 
Augmented And Virtual Reality
Augmented And Virtual Reality Augmented And Virtual Reality
Augmented And Virtual Reality
 
Augmented reality
Augmented realityAugmented reality
Augmented reality
 
Personas
PersonasPersonas
Personas
 
An introduction to mobile app development and investing
An introduction to mobile app development and investingAn introduction to mobile app development and investing
An introduction to mobile app development and investing
 

Semelhante a Image Magic for PowerBuilder

POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...
IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...
IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...IRJET Journal
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Krunal Patel
 
Photo Editing And Sharing Web Application With AI- Assisted Features
Photo Editing And Sharing Web Application With AI- Assisted FeaturesPhoto Editing And Sharing Web Application With AI- Assisted Features
Photo Editing And Sharing Web Application With AI- Assisted FeaturesIRJET Journal
 
MVVM for Modern Applications
MVVM for Modern ApplicationsMVVM for Modern Applications
MVVM for Modern ApplicationsJeremy Likness
 
Image manipulationworkshop amit
Image manipulationworkshop amitImage manipulationworkshop amit
Image manipulationworkshop amitAmit Singhai
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIwhite paper
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Alessandro Molina
 
Machine Learning Use Case - Agriculture
Machine Learning Use Case - AgricultureMachine Learning Use Case - Agriculture
Machine Learning Use Case - AgricultureNilabja GhoshChowdhury
 
IEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer VisionIEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer VisionSAMeh Zaghloul
 
BigML Release: Image Processing
BigML Release: Image ProcessingBigML Release: Image Processing
BigML Release: Image ProcessingBigML, Inc
 
Getting started with Imagemagick
Getting started with ImagemagickGetting started with Imagemagick
Getting started with ImagemagickBart Van Loon
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Windgraphitech
 
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
How to make your Eclipse application HiDPI ready!
How to make your Eclipse application HiDPI ready!How to make your Eclipse application HiDPI ready!
How to make your Eclipse application HiDPI ready!Lakshmi Priya
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Pasi Kellokoski
 
IMAGE CAPTION GENERATOR USING DEEP LEARNING
IMAGE CAPTION GENERATOR USING DEEP LEARNINGIMAGE CAPTION GENERATOR USING DEEP LEARNING
IMAGE CAPTION GENERATOR USING DEEP LEARNINGIRJET Journal
 

Semelhante a Image Magic for PowerBuilder (20)

POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...
IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...
IRJET- Transformation of Realistic Images and Videos into Cartoon Images and ...
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...
 
Photo Editing And Sharing Web Application With AI- Assisted Features
Photo Editing And Sharing Web Application With AI- Assisted FeaturesPhoto Editing And Sharing Web Application With AI- Assisted Features
Photo Editing And Sharing Web Application With AI- Assisted Features
 
Monk objects
Monk objectsMonk objects
Monk objects
 
MVVM for Modern Applications
MVVM for Modern ApplicationsMVVM for Modern Applications
MVVM for Modern Applications
 
Image manipulationworkshop amit
Image manipulationworkshop amitImage manipulationworkshop amit
Image manipulationworkshop amit
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging API
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2
 
Machine Learning Use Case - Agriculture
Machine Learning Use Case - AgricultureMachine Learning Use Case - Agriculture
Machine Learning Use Case - Agriculture
 
IEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer VisionIEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer Vision
 
BigML Release: Image Processing
BigML Release: Image ProcessingBigML Release: Image Processing
BigML Release: Image Processing
 
OpenCV+Android.pptx
OpenCV+Android.pptxOpenCV+Android.pptx
OpenCV+Android.pptx
 
Getting started with Imagemagick
Getting started with ImagemagickGetting started with Imagemagick
Getting started with Imagemagick
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Wind
 
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
How to make your Eclipse application HiDPI ready!
How to make your Eclipse application HiDPI ready!How to make your Eclipse application HiDPI ready!
How to make your Eclipse application HiDPI ready!
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7
 
IMAGE CAPTION GENERATOR USING DEEP LEARNING
IMAGE CAPTION GENERATOR USING DEEP LEARNINGIMAGE CAPTION GENERATOR USING DEEP LEARNING
IMAGE CAPTION GENERATOR USING DEEP LEARNING
 

Último

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Image Magic for PowerBuilder

  • 1. DESIGN AND DEVELOPMENT Image Magic for PowerBuilder A Free Software Package For Easy Image Manipulations Using PowerBuilder By Marco Cimaroli S ix months ago, I was work- the key features for ImageMagick/Pow- ing with my team on a soft- erBuilder integration. Some of these ware project for an enterprise features include: customer on a tool to manage salesman ‘in store merchandising visitation’ . Our 1.) The ‘Identify’ method to retrieve development tools were PowerBuilder the properties image. 10.5 and SQLAnywhere 10. For this project, we had a particular require- 2.) The ‘Convert’ method to: ment to convert and show TIFF images • Re-size an image by a percent. inside the application using a free • Re-size an image by a fixed size. image library. • Superimpose text over an exist- After some google searching, I ing image. discovered an image library called ‘Ima- • Create text images from scratch. geMagick’ that allowed us to convert • Create a JPEG from a PDF file. TIFF files on the fly from PowerScript. • Crop a selection of an image. ImageMagick (www.imagemagick. org) is a free software suite that is 3.) The ‘Mogrify’ method to create distributed with a GPL compatible thumbnails folders. license. It offer several interfaces such as C lib, Dll, COM library and a com- 4.) The ‘Montage’ method to create an mand line converter tool to transform image index from selected thumb- images. nails. Obviously, it doesn’t reach a full integration with PowerBuilder like The ImageMagick Setup some professional image tools (i.e. The first thing to do is to download Marco Cimaroli is a registered Gold Pegasus, Lead-Tools) delivered as ImageMagick (www.imagemagick. ISUG member who works at Selda Activex, but it’s free, and it allowed us org) and to choose the Windows setup. Informatica, an Italian software company to easily manipulate many images using The current version is ImageMagick- located in Ascoli Piceno (Marche,Italy). PowerBuilder objects. Some of these 6.5.9-0-Q16-windows-dll.exe.exe. Marco has used Sybase technology since manipulations include picture control, Run the setup following the setup 1994, starting with PowerBuilder 4.0 and Watcom SQL. Currently, Marco is DataWindow picture control and wizard panels. It is important to have using PowerBuilder 11.5,PocketBuilder bitmap computed columns. ‘administrator’ rights and to check the 2.5, and SQLAnywhere 11 on various For this article, I have created a ‘ImageMagick OLE control’ option. platforms. PowerBuilder 11 example applica- After setup completion, it’s possible to tion, and I have used both the COM verify that environment variables are interface and the “montage” console set correctly simply by calling the fol- command to help explain the some of lowing commands from CMD session: 10 ISUG TECHNICAL JOURNAL
  • 2. IMAGE MAGIC FOR POWERBUILDER co n v e rt l o g o : l o g o. m iff The Convert Method imdi s pl ay l o g o .m iff The ‘Convert’ method is quite powerful as it provides the modification functionality that is necessary for changing If the installation was suc- an image’s format, re-sizing an image, blurring an image, cessful, the ImageMagick cropping an image, flipping an image, joining an image, and picture will be showed as drawing on an existing image as well as much more. in Figure 1. All of the ImageMagick methods that Re-sizing An Image By A Percentage I’ll be covering in this article If we want to convert the size of an image by a percentage, are stored in a PowerBuilder we invoke the ‘Convert’ method passing it a source image, a non-visual object called destination image and re-size factor to apply to the original Figure 1: ImageMagick n_nvo_magick. This object image. For example passing a re-size factor of 50, we obtain is used as a service object a new image with reduced size of 50%. The syntax for this to call the ImageMagick API. I also use some structures to conversion is as follows: store image attributes as well as two DataWindows to display iole_ img . Conver t ( Ò -r esize Ó , st r ing (per c-r esize) + Ó % Ó , both the full image and the thumbnails. Within the COM a s_ fr om_ ima g e, a s_ t o_ ima g e) interface, the connection to the COM server is identified by ‘ImageMagickObject.MagickImage.1’ class name. If you have The method requires four arguments: ‘-resize’ command, problems connecting to the OLE Server, you need to register percentage value, source image, and destination image. The the ImageMagickObject.dll manually using the command: convert method returns a ‘any’ value containing 3 comma regsvr32 /c /s <installation path>ImageMagickObject.dll . separated parameters containing the width, the height and the type of the new image. This can be useful information The Identify Method that we can reuse inside our code. To extract the information from the image via the Image- Note : One particularity of ImageMagick is that it Magick’s ‘Identify’ method, you will need to provide three creates a new image on the hard disk for each image arguments : an identification option, an attribute mask and transformation. an image filename. The syntax for the ‘Identify’ method is below: Re-sizing An Image By A Fixed Size We can also use the ‘Convert’ method with the ‘-resize’ com- iol e _i m g .I de n t i fy ( a s _ id _ ty p e, Ò %w, %h, %b , %f,% c,% g Ó , mand passing it the source and destination images and new as _i m g _f i l e ) fixed dimension for the width and/or height to apply to the The iole_img is the OleObject variable that is connected to original image. For example, if pass only a new width dimen- ImageMagick OleServer. Using the ‘-format ‘ identification sion of 200 pixels, you obtain a new thumbnail image with type we can obtain some important information as specified a max width of 200 pixels and a new relative proportional by the above attribute mask such that: height. This method also requires four arguments: ‘-resize’ • %w returns the width command, a new width (as_dim = “200”), source image, and • %h returns the height destination image. The syntax for the method is: • %b returns the filesize iole_ img . Conver t ( Ò -r esize Ó , a s_ d im, a s_ fr om_i mage, • %f returns the filename a s_ t o_ ima g e) • %c returns the image comment • %g returns the page geometry Superimpose Text Over An Existing Image We can also use the ‘Convert’ method to draw graphic text For a detailed list of possible ‘-format’ arguments you can see on existing image. To do so, we use the ‘Convert’ method http://www.imagemagick.org/script/escape.php web page . with a direct call to the convert.exe program, passing along all The width and height are expressed in pixels and they are the arguments it requires. To run it with a synchronous call, our starting point for calculating the dimensions in PbUnits, we make use of the uo_syncproc Pb object from topwizpro- thereby, allowing us to correctly display our source image on gramming . However, all the work is done by n_nvo_magick a DataWindow computed bitmap column. with the following method: FEBRUARY 2010 11
  • 3. IMAGE MAGIC FOR POWERBUILDER n _n v o _m ag i c k .of_ im g _ d r a w_ tex t ( as_fill_color - color name to fill the text. s t ri n g as _f ro m _ im a g e, s tr in g a s _ to_ im a g e, as_stroke_color - color name for the stroke of text. l o n g al _x _pos , lon g a l_ y _ p os , as_text - the text to draw inside the image. s t ri n g as _f o n t_ n a m e, lon g a l_ p oin t_ s iz e, s t ri n g as _f i ll_ color , s tr in g a s _ s tr ok e_ colo r , In my example application, I have created an image displaying s t ri n g as _t e x t) the text ‘PowerBuilder 11’ shown below in Figure 3. The above method requires the caller to pass the source image path, the destination image path, the x position in pixels, the y position in pixels, the desired font name , the Figure 3: Text Image From Scratch point size, the fill color, the stroke color, and the desired text Create An Image From A PDF File to be drawn. For example, if I call the method with : This function is similar to the other ‘Convert’ options we n _n v o _m ag i c k .of_ im g _ d r a w_ tex t ( ls _ fr om _ ima g e, have already seen with the only difference being that the l s _t o _i m ag e , 1 0 , 30 , Ô T ha om a Õ , 2 4 , source file is not an image but a PDF file. The method to use Ô W h i t e Ô , Õ W h i te Õ , Ô C hies a d i Sa n Fr a n ces co , is as follows: A s c o l i P i c e n o - I ta lia Õ ) n_ nvo_ ma g ick. of_ img _ conver t _ pd f ( st r ing a s_ fr om_ ima g e, st r ing a s_ t o_ ima g e, The following text drawn will be drawn on my image which boolea n a b_ one_ ima g e) is shown below in Figure 2. To do the conversion, the caller must supply the name of PDF file to convert, the name of the destination image and a switch to force the composition of one PDF file when Image- Magick produces more JPEGs from the PDF source file. Crop A Selection Of A Source Image Cropping an image is a familiar operation that everyone uses Figure 2: Image With Annotation to obtain a new image by selecting a portion of an original Create A Text Image From Scratch image and deleting the rest. The method to call to crop an Using the ‘Convert’ method withthis option allows you to image is: create a new image from scratch adding a graphic text to n_ nv nvo_ ma g ick. of_ img _ cr op ( display inside it. The signature for the method is as follows: st r ing a s_ fr om_ ima g e, st r ing a s_ t o_ ima g e, long a l_ w id t h, long a l_ heig ht , long a l_ x_ pos, n _n v o _m ag i c k .of_ im g _ tex t_ fr om _ s cr a tch ( long a l_ y_ pos) s t ri n g as _t o _ im a g e, lon g a l_ wid th_ s iz e, l o n g al _h e i g ht_ s iz e, s tr in g a s _ b a ck _ color , You need to pass it the name of the source image, the name l o n g al _x _pos , lon g a l_ y _ p os , of the destination image, the width and height of the area to s t ri n g as _f o n t_ n a m e, lon g a l_ p oin t_ s iz e, crop, and the coordinate of the top left corner of the area. I s t ri n g as _f i ll_ color , s tr in g a s _ s tr ok e_ colo r , have used a floating DataWindow rectangle (See Figure 4 s t ri n g as _t e x t) and 5) to dynamically show the cropping area to select . The arguments to pass it are the following: as_to_image - name of the destination image. al_width_size - width in pixels. al_height_size - height in pixels. as_back_color - name of the background color. al_x_pos - x coordinate of the text starting point. al_y_pos - y coordinate of the text starting point. as_font_name - name of the font to use. Figure 5: Result Of al_point_size - size of the font. Figure 4: Crop Area Selection Crop Operation 12 ISUG TECHNICAL JOURNAL
  • 4. IMAGE MAGIC FOR POWERBUILDER The Mogrify Method st r ing a s_ ba ckg r ound _ color , st r ing a s_ g eo metry, With the ‘Convert’ re-sizing commands, we have seen how int eg er a i_ t ile_ col_ num, int eg er a i_ t ile_ r ow_nu m, to create a thumbnail image starting from the original image. boolea n a b_ pola r oid , st r ing a s_ ima g e_ ba ckc ol or, Now we will discover the ‘Mogrify’ command that allows us boolea n a b_ a d d _ t it le, st r ing a s_ t it le, to create many thumbnails at once . For this purpose, I have st r ing a s_ t it le_ font , st r ing a s_ t it le_ point si z e) implemented the following method: This method needs the following arguments: n _n v o _m ag i c k .o f_ im g _ cr ea te_ fold er _ thu m b s( as_ini_folder - folder path containing thumbnails. s t ri n g as _s o u r ce_ p a th, as_dest_folder - destination folder path. s t ri n g as _i m a g e_ ex ten s ion , as_source_images - array of selected thumbnails. DESIGN AND DEVELOPMENT s t ri n g as _o u tp u t_ p a th, s tr in g a s _ ou tp u t_ f or ma t , as_dest_image - name of the new image. l o n g al _t h umb _ wid th, lon g a l_ thu m b _ height , ai_thumb_width - width of the thumbnails. re f s t _i m g _a ttr ib a s _ im g _ a r r a y [ ] ) ai_thumb_height - height of the thumbnails. as_border_color - image border color. It requires the followings arguments: as_background_color - image background color. as_source_path - complete path of the folder that as_geometry - geometry that specifies spaces be- contains original images. tween new image thumbnails. as_image_extension - image extension to convert. ai_tile_col_num - number of columns to distribute as_output_path - complete path of the folder that thumbnails inside the new image. will contain the thumbnails. ai_tile_row_num - number of rows to distribute. as_output_format - output image type (e.g. bmp). thumbnails inside the new image. al_thumb_width - width dimension (in pixels). ab_polaroid - thumbnails’ polaroid effect switch. al_thumb_height - height dimension (in pixels). as_image_backcolor - new background color. as_img_array[] - array of type stimg_attrib contain- ab_add_title - title switch. ing thumbnails attributes. as_title - title of the new image. as_title_font - title font name (e.g. Arial). In my example, I have as_title_pointsize - title font size (e.g. 12). selected c:temp as the source folder, JPEG as the image In my example, I have extension , c:tempthumbs as selected five images and output folder , GIF as the output I have obtained the new type and 200x200 pixels as the image as shown in Figure thumbnails dimensions. After 6. It is a JPEG image with the creation of the thumbnails, 3 columns, 2 rows, white Figure 5: Thumbnails I have used a DataWindow to thumbnails border color , display thumbs on the screen as gray thumbnails background shown in Figure 5. Figure 6: New Image color, thumbnails with a From Five Thumbnails polaroid effect, white image The Montage Method background color and a Lastly, I will explain how to create an image index as a collage ‘ISUG index’ title . of a collection of selected thumbnails using the ‘Montage’ method. To do this, I have first implemented a script to allow Conclusion us to select thumbnails from the DataWindow container and I have finished with the explanation of the major features then I have implemented the following method: of the ImageMagick library. You can find other interesting n _n v o _m ag i c k .of_ im g _ m a k e_ m on ta g e ( examples and the source code on the ISUG web site (www. s t ri n g as _i n i_ fold er , s tr in g a s _ d es t_ fold e r , isug.com). Some of these additional examples include raise, s t ri n g as _s o u r ce_ im a g es [ ] , s tr in g a s _ d es t_ ima g e, blur, swirl, frame, polaroid and flip. Likewise, you can add i n t e g e r ai _t h u m b _ wid th, other functionalities simply by reading the ImageMagick i n t e g e r ai _t h u m b _ heig ht, s tr in g a s _ b or d er _ color , documentation and writing them in PowerScript code. FEBRUARY 2010 13