Next Semester PowerPoint PPT Presentation

presentation player overlay
1 / 4
About This Presentation
Transcript and Presenter's Notes

Title: Next Semester


1
Session 37
  • Next Semester
  • Shrinking the size of our photo/text files

2
Next Semester
  • Assuming that you have a C or better in this
    course you should sign up for
  • 810052 (with me, sorry) However, you will
    need to get a pre-req exception
  • and if you havent had it yet, 810080
  • I will be using the same book that Dr. Fienup is
    using for 810063 this semester so if you can
    work something out

3
writePictureToTextFile()
  • def writePictureToTextFile(picture,file)
  • file open(file,"wt")
  • file.write( str(getWidth(picture)) ",)
  • file.write( str(getHeight(picture)) "\n" )
  • for p in getPixels(picture)
  • file.write( str(p.getRed()) "," )
  • file.write( str(p.getGreen()) "," )
  • file.write( str(p.getBlue()) "\n" )
  • file.close()

4
writePictureDiffsToTextFile()
  • def writePictureDiffsToTextFile(picture,file)
  • file open(file,"wt")
  • file.write( str(getWidth(picture)) ","
    str(getHeight(picture)) "\n" )
  • pgetPixel(picture,1,1)
  • r1p.getRed()
  • g1p.getGreen()
  • b1p.getBlue()
  • count0
  • for p in getPixels(picture)
  • r2 p.getRed()
  • g2 p.getGreen()
  • b2 p.getBlue()
  • if (r1r2 and g1g2 and b1b2)
  • countcount1
  • else
  • write(r1,g1,b1,count)
  • count1
  • r1r2
  • g1g2
Write a Comment
User Comments (0)
About PowerShow.com