Skip to content

Commit

Permalink
Added software license and script. Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
m2orris committed Jan 15, 2013
1 parent 2d8339e commit d6b967f
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 3 deletions.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2012 Michael Morris

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
GIMP-scripts
============
#GIMP-scripts
###Version 1.0
#####Copyright (c) 2013 Michael Morris<br>This software is released under MIT Open Source License

Various scripts for GIMP
**************

##Objective

`GIMP-scripts` is a collection of macros or scripts for GIMP.

**************

###Script-Fu / export_iOS_icons_of_image.scm###

Exports iOS icons of the current image. Methods include:

* **Icons for Device(s)** - Exports iOS icons of the current image for the devices specified by the user in the "Script-Fu: Icons for Device(s)" window. This function is found under: `File --> Export iOS Icon of Image --> Icons for Device(s) ...`

* **Single Icon** - Exports a single iOS icon of the current image specified by the user in the "Script-Fu: Single Icon" window. This function is found under: `File --> Export iOS Icon of Image --> Single Icon ...`

##Installation
1. Copy the scripts from the `GIMP-scripts/Script-Fu` directory to the GIMP scripts directory.
2. Start GIMP
3. In GIMP `Filters --> Script-Fu --> Refresh Script`
98 changes: 98 additions & 0 deletions Script-Fu/export_iOS_icons_of_image.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
; export_iOS_icons_of_image.scm
; Copyright (c) 2013 Michael Morris
; This software is released under MIT Open Source License
; ==============================================================================

(define (export-ios-icon-of-image inImage inDrawable inPath inFilename inDimension)
(let* (
(thePathAndFilename (string-append inPath DIR-SEPARATOR inFilename)))

; Check to make sure thePathAndFilename does not exist
(if (file-exists? thePathAndFilename)

; The file exists, display message and exit
(gimp-message (string-append "The file:[" thePathAndFilename "] exists, skipping."))

; The file does not exist, duplicate, scale, export, and delete duplicate
(let (
(theDuplicateImage (car (gimp-image-duplicate inImage))))

(gimp-image-scale theDuplicateImage inDimension inDimension)
(file-png-save
RUN-NONINTERACTIVE
theDuplicateImage
(car (gimp-image-flatten theDuplicateImage))
thePathAndFilename
inFilename
0 ; Use Adam7 interlacing?
9 ; Deflate Compression factor (0--9)
0 ; Write bKGD chunk?
0 ; Write gAMA chunk?
0 ; Write oFFs chunk?
0 ; Write pHYs chunk?
0) ; Write tIME chunk?
(gimp-image-delete theDuplicateImage)
)
)
)
)

(script-fu-register
"export-ios-icon-of-image" ;func name
"Single Icon ..." ;menu label
"Exports an iOS icon of the image around the user's choice of:\
path, filename, and width in pixels." ;description
"Michael Morris" ;author
"Copyright (c) 2013 Michael Morris\
This software is released under MIT Open Source License" ;copyright notice
"January 10, 2013" ;date created
"*" ;image type that the script works on
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-DIRNAME "Path" "/tmp"
SF-STRING "Filename" "Icon.png"
SF-VALUE "Width in Pixels" "57"
)

(script-fu-menu-register "export-ios-icon-of-image" "<Image>/File/Export iOS Icon of Image")

; ==============================================================================

(define (export-ios-icons-of-image-for-device inImage inDrawable inPath iniPadIcons iniPhoneIcons)

(if (or (= 1 iniPadIcons) (= 1 iniPhoneIcons))
(begin
(export-ios-icon-of-image inImage inDrawable inPath "iTunesArtwork@2x" 1024)
(export-ios-icon-of-image inImage inDrawable inPath "iTunesArtwork" 512)
(export-ios-icon-of-image inImage inDrawable inPath "Icon-Small@2x.png" 58)
(export-ios-icon-of-image inImage inDrawable inPath "Icon-Small.png" 29)))
(if (= 1 iniPadIcons)
(begin
(export-ios-icon-of-image inImage inDrawable inPath "Icon-72@2x.png" 144)
(export-ios-icon-of-image inImage inDrawable inPath "Icon-72.png" 72)
(export-ios-icon-of-image inImage inDrawable inPath "Icon-Small-50@2x.png" 100)
(export-ios-icon-of-image inImage inDrawable inPath "Icon-Small-50.png" 50)))
(if (= 1 iniPhoneIcons)
(begin
(export-ios-icon-of-image inImage inDrawable inPath "Icon@2x.png" 114)
(export-ios-icon-of-image inImage inDrawable inPath "Icon.png" 57)))
)

(script-fu-register
"export-ios-icons-of-image-for-device" ;func name
"Icons for Device(s) ..." ;menu label
"Exports iOS icons of the image around the user's choice of:\
path and device(s): iPad and/or iPhone/iPod touch";description
"Michael Morris" ;author
"Copyright (c) 2013 Michael Morris\
This software is released under MIT Open Source License" ;copyright notice
"January 10, 2013" ;date created
"*" ;image type that the script works on
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-DIRNAME "Path" "/tmp"
SF-TOGGLE "Create iPad icons" 1
SF-TOGGLE "Create iPhone/iPod touch icons" 1
)

(script-fu-menu-register "export-ios-icons-of-image-for-device" "<Image>/File/Export iOS Icon of Image")

0 comments on commit d6b967f

Please sign in to comment.