En cas de doute, sachez qu'il existe aussi des anti-virus pour Linux
- L'article les anti-virus sous Linux (publié par Ubuntu-fr.org)
- Je vous propose la lecture de l'article Clamav sur Ubuntu-fr.org
The notes of a developer exploring platforms, languages and technologies.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# GIMP Python plug-in template.
from gimpfu import *
import sys
__DEBUG = True
# Redirect the print statement to file (usefull for debugging)
if __DEBUG:
  sys.stderr = open( 'c:\\temp\\gimpstderr.txt', 'w')
  sys.stdout = open( 'c:\\temp\\gimpstdout.txt', 'w')
def gimp_log( sMsg ):
  """ Log to StdOut (or nothing) depending on the __DEGUG flag """
  if __DEBUG:
    print( sMsg )
  else:
    pass
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# GIMP Python plug-in template.
from gimpfu import *
import sys
__DEBUG = True
# Redirect the print statement to file (usefull for debugging)
if __DEBUG:
  sys.stderr = open( 'c:\\temp\\gimpstderr.txt', 'w')
  sys.stdout = open( 'c:\\temp\\gimpstdout.txt', 'w')
def gimp_log( sMsg ):
  """ Log to StdOut (or nothing) depending on the __DEGUG flag """
  if __DEBUG:
    print( sMsg )
  else:
    pass
    
# Display a message in the status bar
#    pdb.gimp_message("test")
# Some functions about progress 
#
#    pdb.gimp_progress_init( 'Test2', None )
#    pdb.gimp_progress_set_text('This goes to the status bar')
#    pdb.gimp_progress_pulse()
#    pdb.python_fu_console()
#    pdb.gimp_progress_end()
def do_gg_crop_resize():
    """ Crop image to selection THEN scale image to fit properly a 2848 x 2848 
        picture THEN resize Canvas to fit photo format 4282 x 2848 (image 
        centered)"""
    # Diplay message in the bottom of the console
    pdb.gimp_message("GG Crop Resize...")
  
    # Print to the standard output (which is a file)    
    gimp_log( "do_gg_crop_resize:")
     
    # Set up an undo group, so the operation will be undone in one step.
    #pdb.gimp_undo_push_group_start(img)
    # NB: The last opened file is always at index 0, previous opened file 
    #     at index 1 and so on.
    count = len( gimp.image_list() )
    img = gimp.image_list()[count-1]
    sel = pdb.gimp_selection_bounds(img)
    if sel[0] == 0:
      pdb.gimp_message("GG Crop Resize Stopped - No selection!")
      gimp_log( "Stopped! No selection" )
      return
      
    # Crop the image 
    pdb.gimp_image_crop( img, sel[3]-sel[1], sel[4]-sel[2], sel[1], sel[2] )
    gimp_log( "Current Size (width,height)=(%i,%i)" % (img.width,img.height) )
    
    # Calculate Image Ratio
    ratio = img.height / float(img.width)
    gimp_log( "Current Ratio Height/width = %f" % (ratio) )
    
    if img.width > img.height:
      gimp_log( "Image is Larger THEN scale width " )
      pdb.gimp_image_scale( img, 2848, 2848 * ratio ) # New Width, New Height
      pdb.gimp_image_resize( img, 4282, 2848, (4282-img.width)/2, (2848-img.height)/2 )
      
      
    else:
      gimp_log( "Image is Higher THEN scale height ")
      pdb.gimp_image_scale( img, 2848 / ratio, 2848 )
      pdb.gimp_image_resize( img, 4282, 2848, (4282-img.width)/2, (2848-img.height)/2 )
      
    pdb.gimp_message( "GG Crop Resize completed" ) 
    gimp_log( "Treatment complete" )
    # Close the undo group.
    #pdb.gimp_undo_push_group_end(img)
register(
    "gg_crop_resize",
    "Crop and resize to photo",
    "Crop to selection, resize and center to Photo dimensions",
    "Meurisse D.",
    "Guy Gerard SPRL",
    "2014",
    "GG Crop Resize", # Menu item Name
    "*",      # Alternately use RGB, RGB*, GRAY*, INDEXED etc.
    [],
    [],
    do_gg_crop_resize, 
    menu="<Image>/GG"  # Host menu for the MenuItem
    
)
main()