[Paraview] Background: trim, transparent?

burlen burlen.loring at gmail.com
Sun Dec 19 13:54:20 EST 2010


>
>   This is not batchable though I believe.
>    
gimp is batchable, just a bit more involved than imagemagick. use the 
procedure browser to find the procedure call signatures.



On 12/18/2010 1:04 AM, Nico Schlömer wrote:
> Oh yes, I mean, you can autotrim with imagemagick as well, for example by
>
>     mogrify -path ./destination -format png -trim *.png
>
> This is for a batch job in fact; for single images, gimp certainly
> comes in handy, particularly because you can select the background and
> make it transparent there. This is not batchable though I believe.
>
> Cheers,
> Nico
>
>
>
> On Fri, Dec 17, 2010 at 7:47 PM, burlen<burlen.loring at gmail.com>  wrote:
>    
>> Hi,
>>
>> ParaView doesn't currently do this (unless its implemented in the
>> development version which I haven't used in a while).
>>
>> A quick and dirty approach is with the ImageMagick suite. Another option is
>> the GIMP scriptfu. In either case one can apply the desired operations to an
>> image or a series of images generated in PV from the command line. I'm
>> partial to the GIMP because it offers so much more functionality than
>> ImageMagick. I am including a scriptfu I wrote to autocrop images from PV.
>> It's in 2 parts, a bash script that hides some of the nastyness of invoking
>> a scriptfu from the command line, and a scm scriptfu. Place the scm scriptfu
>> in ~/gimp-X.X/scripts . X.X is the GIMP version number on your system. That
>> should get you started.
>>
>> Burlen
>>
>> fist file: sq-auto-crop.sh
>>
>> #!/bin/bash
>>
>> if [ $# -ne 2 ] ; then
>>   echo "Usage: $0 infile outfile"
>>   exit 1
>> fi
>>
>> gimp -i -b "(sq-auto-crop \"$1\" \"$2\")" -b '(gimp-quit 0)'
>>
>> #EOF
>>
>>
>>
>> second file: sq-auto-crop.scm
>>
>> ;------------------------------------------------------------------------------
>> (define
>>   (sq-auto-crop inFile outFile)
>>     (let*
>>       (
>>       (im   0)
>>       (dw   0)
>>       )
>>
>>       ; load the original
>>       (set! im (car (gimp-file-load RUN-NONINTERACTIVE inFile inFile)))
>>       (set! dw (car (gimp-image-get-active-layer im)))
>>
>>       ; auto-crop
>>       (plug-in-autocrop RUN-NONINTERACTIVE im dw)
>>
>>       ; save the cropped image
>>       (gimp-file-save RUN-NONINTERACTIVE im dw outFile outFile)
>>     )
>> )
>>
>> ;EOF
>>
>> On 12/16/2010 04:43 PM, Nico Schlömer wrote:
>>      
>>> Hi all,
>>>
>>> for Paraview's "Save Screenshot" or "Save Animation", is it possible
>>> to trim the resulting image to to get rid of the unnecessary
>>> background, and even more so, to treat the background color as
>>> "transparent" (e.g. when exporting to PNG)?
>>>
>>> Cheers,
>>> Nico
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ParaView Wiki at:
>>> http://paraview.org/Wiki/ParaView
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.paraview.org/mailman/listinfo/paraview
>>>        
>>
>>      



More information about the ParaView mailing list