diff convert.xml @ 8:99217847314a draft

planemo upload for repository https://github.com/bgruening/galaxytools/new/gm/tools/image_processing/image_processing/ commit b81f7b8b0253917d3322c08d884a5a86a3b7e0fe
author bgruening
date Mon, 04 Dec 2023 16:27:57 +0000
parents ff05b2c4263c
children 5376a7767fb3
line wrap: on
line diff
--- a/convert.xml	Sun Nov 05 14:34:35 2023 +0000
+++ b/convert.xml	Mon Dec 04 16:27:57 2023 +0000
@@ -1,4 +1,4 @@
-<tool id="graphicsmagick_image_convert" name="Convert image format" version="@VERSION@+galaxy2">
+<tool id="graphicsmagick_image_convert" name="Convert image format" version="@VERSION@+galaxy3">
     <description>with GraphicsMagick</description>
     <macros>
         <import>macros.xml</import>
@@ -14,9 +14,18 @@
             #set $trans_options = ''
         #end if
 
-        gm convert -resize ${resize}%x $trans_options input.${input.ext} temp.${output_format}
+        gm convert
+            -resize ${resize}%x
+            $trans_options
+            #if $palette.palette_select == "automatic"
+            -type Palette
+            #else if $palette.palette_select == "manual"
+            -colors '${palette.palette}'
+            #end if
+            'input.${input.ext}'
+            'temp.${output_format}'
         &&
-        mv temp.${output_format} '${output}'
+        mv 'temp.${output_format}' '${output}'
 ]]>
     </command>
     <inputs>
@@ -28,6 +37,18 @@
             <option value="-rotate 270">rotate 90 degree to the left</option>
             <option value="-rotate 180">rotate 180 degree</option>
         </param>
+
+        <conditional name="palette">
+            <param name="palette_select" type="select" label="Reduce Color Palette">
+                <option value="no" selected="true">No</option>
+                <option value="automatic">Automatic</option>
+                <option value="manual">Manual</option>
+            </param>
+            <when value="automatic" />
+            <when value="manual">
+                <param name="palette" type="integer" min="1" label="Color Palette Size" value="32" help="Number of colors to use, should be in powers of 2 (1, 2, 4, 8, 16, 32, 64, ...), otherwise space is wasted in the palette."/>
+            </when>
+        </conditional>
         <param name="resize" type="float" value="100" label="Resize (%)" min="0"/>
         <param name="output_format" type="select" label="Output Format">
                 <option value="jpg">jpg</option>
@@ -62,6 +83,23 @@
           <param name="resize" value="50" />
           <output name="output" file="result_image_convert_1.png" compare="sim_size" delta="20000" />
       </test>
+      <test>
+          <param name="input" value="donald.jpg" />
+          <param name="output_format" value="jpg"  />
+          <conditional name="palette">
+              <param name="palette_select" value="automatic" />
+          </conditional>
+          <output name="output" file="donald-palette.jpg" compare="sim_size" delta="20000" />
+      </test>
+      <test>
+          <param name="input" value="donald.jpg" />
+          <param name="output_format" value="jpg"  />
+          <conditional name="palette">
+              <param name="palette_select" value="manual" />
+              <param name="palette" value="2" />
+          </conditional>
+          <output name="output" file="donald-colors-2.jpg" compare="sim_size" delta="20000" />
+      </test>
   </tests>
     <help>
 <![CDATA[