AutoHotkey Community

It is currently May 26th, 2012, 3:52 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: April 8th, 2009, 8:07 pm 
Offline

Joined: March 10th, 2008, 12:55 am
Posts: 1907
Location: Minnesota, USA
IMmI- ImageMagick montage Interface
Image

What is a Tile Set? Click Here!
ABOUT:
A basic graphical interface for ImageMagick's montage tool.
Montage, turns a set of images into 1 (depending on limits) big tiled image. Or turn an animated images into 1 big image (depending on limits).
You could also use this as an image converter.
This is just a very tiny bit of what the actual commad-line app can do, but this is the most important stuff in montage. In my opinion.

Montage.exe is part of the ImageMagick command-line tool set.
Don't ask me to update/fix it. I hold no responsiblility if any damage is done.
The command-line app has MUCH more feature/tools/options then what this app does. This is just for basic tile-set making.

TIPS/TRICKS:
1) Leave width or height, or both, at 0 to make a perfect fit on 1 image, accordingly.
2) Use wild cards in the Names box to search multple extensions.
3) Click the blue text at the top to go to the ImageMagick website.
4) It doesn't matter if you type or don't type the leading period in the FileType field.
5) Wait awhile for the image to complete. it may take awhile depending on: your PC, how many images, overall image size, file type, image sizes.
6) The number to the left of the Names box is the number of lines use (images). There is a blank line at bottom by default. That line desnt effect anything. You may leave or delete.
7) You can also use it to convert/mass-convert files, specify 1 and 1 in the tile amount fields.

DOWNLOAD:
montage.exe is required. it is a 1.4MB file, 5MB extracted. Put it in the same folder as the script.
Code:
    ; ABOUT:
 ; A basic graphical interface for ImageMagick's montage tool.
 ; Montage, turns a set of images into 1 (depending on limits) big tiled image. Or turn an animated images into 1 big image (depending on limits).
 ; You could also use this as an image converter.
 ; This is just a very tiny bit of what the actual commad-line app can do, but this is the most important stuff in montage. In my opinion.

 ; Montage.exe is part of the ImageMagick command-line tool set.
 ; Don't ask me to update/fix it. I hold no responsiblility if any damage is done.
 ; The command-line app has MUCH more feature/tools/options then what this app does. This is just for basic tile-set making.

 ; TIPS/TRICKS:
 ; Leave width or height, or both, at 0 to make a perfect fit on 1 image, accordingly.
 ; Use wild cards in the Names box to search multple extensions.
 ; Click the blue text at the top to go to the ImageMagick website.
 ; It doesn't matter if you type or don't type the leading period in the FileType field.
 ; Tllow awhile for the image to complete. it may take awhile depending on: your PC, how many images, overall image size, file type, image sizes.
 ; The number to the left of the Names box is the number of lines use (images). There is a blank line at bottom by default. That line desnt effect anything. You may leave or delete.
 
 
;_-Created by: tidbit
;_-Enjoy~~!!
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force

allowed=BMP,GIF,ICO,JPG,JPEG,PNG,SVG,TGA,TIFF
bgColor=336699
help=
(
-> The Wild Card  character ( * ) is supported in the "File type" field.
-> You may use Wildcards in the Names box as well.
-> Please only insert 1 File type (image filetype) in the "File type" field.
-> Enclose file names in quotes (" ") if they have a space in them.
-> bmp, gif, ico, jpg, jpeg, png, svg, tga, tiff. Are all supported.
)

;_-=============-_;
;_-====OTHER====-_;
;_-=============-_;
Gui, font, underline s10
Gui, Add, Text, x6 y4 w350 h28 0x400000 +Center 0x200 Cblue gurl , ImageMagick montage Interface
Gui, font, normal s8

Gui, Add, Text, x6 y38 w40 h20 , Look in:
Gui, Add, Edit, x46 y38 w260 h20 vseldir ,
Gui, Add, Button, x306 y38 w50 h20 gbrowse , Browse

;_-====================-_;
;_-====Width/Height====-_;
;_-====================-_;
Gui, Add, GroupBox, x6 y68 w180 h70 , Width/Height
Gui, Add, Text, x16 y88 w90 h20 , Number of X tiles:
Gui, Add, Edit, x106 y88 w70 h20 +number
Gui, Add, UpDown, x106 y88 w70 h20 0x80 vxt, 0
Gui, Add, Text, x16 y108 w90 h20 , Number of Y tiles:
Gui, Add, Edit, x106 y108 w70 h20 +number
Gui, Add, UpDown, x106 y88 w70 h20 0x80 vyt , 0


;_-===========================-_;
;_-====Tile Offset Spacing====-_;
;_-===========================-_;
Gui, Add, GroupBox, x6 y138 w180 h70 , Tile Offset Spacing
Gui, Add, Text, x16 y158 w90 h20 , Horizontal:
Gui, Add, Edit, x106 y158 w70 h20 +number
Gui, Add, UpDown, x106 y88 w70 h20  Range-1000-1000 0x80 vtsx, 0
Gui, Add, Text, x16 y178 w90 h20 , Verticle:
Gui, Add, Edit, x106 y178 w70 h20 +number
Gui, Add, UpDown, x106 y88 w70 h20 Range-1000-1000 0x80 vtsy, 0

;_-========-_;
;_-==MISC===_;
;_-========-_;
Gui, Add, GroupBox, x186 y68 w170 h140 , Misc
Gui, Add, Button, x196 y88 w100 h20 gcolor , BackGround Color
Gui, Add, Progress, c%bgcolor% x296 y88 w50 h20 vprevcol , 100

Gui, Add, Button, x196 y178 w150 h20 gsave, Save

;_-===========-_;
;_-==FILTERS===_;
;_-===========-_;
Gui, Add, GroupBox, x6 y208 w350 h260 , Filters
Gui, Add, Radio, x16 y228 w330 h20 gfilter vfilter, Manually list Names with the Extensions (1 name per line.).
Gui, Add, Radio, x16 y248 w330 h20  gfilter +Checked, Search all Names and go by Extension.

Gui, Add, Text, x16 y278 w40 h20 , Names:
Gui, Add, Text, x16 y308 w40 h20 vnum,
Gui, Add, Edit, x56 y278 w290 h80 +HScroll +Disabled vnames gcount,
Gui, Add, Text, x16 y368 w50 h20 , File type:
Gui, Add, Edit, x66 y368 w90 h20 vfiletype,`*
Gui, Add, Text, c9026AF x16 y393 w330 ,%help%

Gui, Show, x131 y91  w362, IMMI`, Created by`: tidbit
Return

;_-========-_;
;_-==SAVE===_;
;_-========-_;
save:
Gui, submit, nohide

 If RegExMatch(seldir, "^\s*$") ;Thanks Titan.
    {
        MsgBox, Please Select a Folder.
        Return
    }
   
FileSelectFile, save , S18,%A_Desktop%, Where would you like to save`?, Images (*.bmp; *.gif; *.ico; *.jpg; *.jpeg; *.png; *.svg; *.tga; *.tiff) All (*.*)

 If RegExMatch(save, "^\s*$") ;Thanks Titan.
        Return
   
        IfInString, save, %a_Space%
            save=`"%save%`"
        Else
            save=%save%
           

 ifinstring, filetype, .
StringReplace, filetype, filetype, .,, ALL

names := RegExReplace(names, "\n", " ")

    if filter=1
    imgs=%names%
    else
    imgs=*.%filetype%
   
    if tsx>=0
    tsx=+%tsx%
    else
    tsx=%tsx%
   
    if tsy>=0
    tsy=+%tsy%
    else
    tsy=%tsy%

Run, montage.exe -background #%bgcolor% -tile %xt%x%yt%  -geometry %tsx%%tsy% %imgs% %save%, %seldir%

return

;_-==========-_;
;_-==BROWSE===_;
;_-==========-_;
browse:
    FileSelectFolder, seldir, %A_DESKTOP%, 3, Select a folder to search for images.
    If seldir =
        Return
    Else
        GuiControl, , seldir, %seldir%

    GuiControl, , names,
    Loop, %seldir%\*.*
    {
        Gui, Submit, NoHide
        IfInString, A_LoopFileName, %a_Space%
            j=`"%A_LoopFileName%`"
        Else
            j=%A_LoopFileName%
           
        If A_LoopFileExt Contains %allowed%
            GuiControl, , names,%names% %j%`r`n
    }
    gosub, count
Return

;_-===========-_;
;_-==FILTERS===_;
;_-===========-_;
filter:
    Gui, Submit, NoHide
    If filter=1
    {
        GuiControl, Enable, names
        GuiControl, Disable, filetype
    }
    If filter=2
    {
        GuiControl, Disable, names
        GuiControl, Enable, filetype
    }
Return

;_-================-_;
;_-==COLOR SELECT===_;
;_-================-_;
color:
    CmnDlg_Color( bgColor := 0xBC5E5E )
    If bgColor=false
        Return
    StringReplace, bgColor, bgColor, 0x,
    GuiControl, +c%bgColor%, prevcol
Return

count:
Gui, submit, nohide
Loop, parse, names, `n
    count:=A_Index
GuiControl, ,num, %count%
return

url:
run, http://www.imagemagick.org/script/index.php
return

GuiClose:
    ExitApp
Return

;----------------------------------------------------------------------------------------------
; Thanks majkinetor for this function
;
;
; Parameters:
;            pColor   - Initial color and output in RGB format,
;            hGui   - Optional handle to parents HWND
;
; Returns:
;            False if user canceled the dialog or if error occurred
;
;
CmnDlg_Color(ByRef pColor, hGui=0){
        ;covert from rgb
        clr := ((pColor & 0xFF) << 16) + (pColor & 0xFF00) + ((pColor >> 16) & 0xFF)

        VarSetCapacity(sChooseColor, 0x24, 0)
        VarSetCapacity(aChooseColor, 64, 0)

        NumPut(0x24,       sChooseColor, 0)      ; DWORD lStructSize
        NumPut(hGui,       sChooseColor, 4)      ; HWND hwndOwner (makes dialog "modal").
        NumPut(clr,          sChooseColor, 12)     ; clr.rgbResult
        NumPut(&aChooseColor,sChooseColor, 16)     ; ColorREF *lpCustColors
        NumPut(0x00000103,    sChooseColor, 20)     ; Flag: CC_ANYColor || CC_RGBINIT

        nRC := DllCall("comdlg32\ChooseColorA", str, sChooseColor)  ; Display the dialog.
        If (Errorlevel <> 0) || (nRC = 0)
            Return  false


        clr := NumGet(sChooseColor, 12)

        oldFormat := A_FormatInteger
        SetFormat, Integer, hex  ; Show RGB Color extracted below in hex format.

        ;convert to rgb
        pColor := (clr & 0xff00) + ((clr & 0xff0000) >> 16) + ((clr & 0xff) << 16)
        StringTrimLeft, pColor, pColor, 2
        Loop, % 6-StrLen(pColor)
            pColor=0%pColor%
        pColor=0x%pColor%
        SetFormat, Integer, %oldFormat%

     Return true
    }

_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
"I think Bigfoot is blurry, that's the problem. It's not the photographer's fault, Bigfoot is blurry. So there's a large, out-of-focus monster roaming the countryside."


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: shassen95 and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group