Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25306

Modified Files:
        videothumb.py 
Log Message:
o let mplayer keep the aspect of the movie
o add bars/resize to fit 4:3 so all thumbnails have the same geometry


Index: videothumb.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/videothumb.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** videothumb.py       1 Feb 2004 17:05:28 -0000       1.6
--- videothumb.py       8 Feb 2004 12:09:01 -0000       1.7
***************
*** 14,17 ****
--- 14,21 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.7  2004/02/08 12:09:01  dischi
+ # o let mplayer keep the aspect of the movie
+ # o add bars/resize to fit 4:3 so all thumbnails have the same geometry
+ #
  # Revision 1.6  2004/02/01 17:05:28  dischi
  # popup support
***************
*** 95,101 ****
              image = Image.open(imagefile)
              image.thumbnail((300,300), Image.ANTIALIAS)
              if image.mode == 'P':
                  image = image.convert('RGB')
!             image = image.crop((5, 0, image.size[0]-10, image.size[1]))
              if imagefile.endswith('.raw'):
                  data = (image.tostring(), image.size, image.mode)
--- 99,115 ----
              image = Image.open(imagefile)
              image.thumbnail((300,300), Image.ANTIALIAS)
+             if image.size[0] * 3 > image.size[1] * 4:
+                 # fix image with blank bars to be 4:3
+                 ni = Image.new('RGB', (image.size[0], (image.size[0]*3)/4))
+                 ni.paste(image, (0,(((image.size[0]*3)/4)-image.size[1])/2))
+                 image = ni
+             elif image.size[0] * 3 < image.size[1] * 4:
+                 # strange aspect, let's guess it's 4:3
+                 image = Image.open(imagefile).resize((image.size[0], 
(image.size[0]*3)/4),
+                                                      Image.ANTIALIAS)
              if image.mode == 'P':
                  image = image.convert('RGB')
!             # crob some pixels, looks better that way
!             image = image.crop((4, 3, image.size[0]-8, image.size[1]-6))
              if imagefile.endswith('.raw'):
                  data = (image.tostring(), image.size, image.mode)
***************
*** 103,107 ****
              else:
                  image.save(imagefile)
!         except OSError:
              pass
  
--- 117,121 ----
              else:
                  image.save(imagefile)
!         except (OSError, IOError):
              pass
  
***************
*** 136,140 ****
      # call mplayer to get the image
      child = popen2.Popen3((mplayer, '-nosound', '-vo', 'png', '-frames', '8',
!                            '-ss', position, filename), 1, 100)
      while(1):
          data = child.fromchild.readline()
--- 150,154 ----
      # call mplayer to get the image
      child = popen2.Popen3((mplayer, '-nosound', '-vo', 'png', '-frames', '8',
!                            '-ss', position, '-zoom', filename), 1, 100)
      while(1):
          data = child.fromchild.readline()



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to