From d6b967feff55096b8636b28b70a89b141f8b76c9 Mon Sep 17 00:00:00 2001 From: Michael Morris Date: Tue, 15 Jan 2013 17:19:06 -0600 Subject: [PATCH] Added software license and script. Updated README.md --- LICENSE | 7 ++ README.md | 26 ++++++- Script-Fu/export_iOS_icons_of_image.scm | 98 +++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 LICENSE create mode 100644 Script-Fu/export_iOS_icons_of_image.scm diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fcf15c2 --- /dev/null +++ b/LICENSE @@ -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. \ No newline at end of file diff --git a/README.md b/README.md index 62a6533..00abf68 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,24 @@ -GIMP-scripts -============ +#GIMP-scripts +###Version 1.0 +#####Copyright (c) 2013 Michael Morris
This software is released under MIT Open Source License -Various scripts for GIMP \ No newline at end of file +************** + +##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` \ No newline at end of file diff --git a/Script-Fu/export_iOS_icons_of_image.scm b/Script-Fu/export_iOS_icons_of_image.scm new file mode 100644 index 0000000..2166151 --- /dev/null +++ b/Script-Fu/export_iOS_icons_of_image.scm @@ -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" "/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" "/File/Export iOS Icon of Image")