Class 33 — November 8

Image visualization

What do you picture – For your future life to be – We wish you success


Look both ways


Video


Agenda


Example

  • How do the dimensions of the transformation compare with the original?
  • What is the correspondence between the pixels from the transformation with pixels from the original?

# get dimensions of the original

ow, oh = original.size

 

# set dimensions of the copy

nw, nh = ..., ...

 

# get a new appropriately sized image

new_image = Image.new( 'RGB', ( nw, nh ) )

 

# fill in every pixel of the new image

for nx in range( 0, nw ) : # consider every x value for the new image

  for ny in range( 0, nh ) : # in tandem with every y value for the image

 

  # set the spot to be filled in the new image

  nspot = (nx ,ny )

 

  # determine the corresponding spot in the original to be copied

  ox = ...

  oy = ...

 

  ospot = ( ox, oy )

 

  # get the pixel at the ospot

  opixel = original.getpixel( ospot )

 

  # determine the pixel for the new image

  npixel = ...

 

  # set the nspot in the new image

  new_image.putpixel( nspot, npixel )

 

# return the filled in new image

return new_image


To do




Transformations

original original

Duplicated image


original original

Mirrored image


originaloriginal

Flipped image


originaloriginal

Clockwise rotation


original mixed scaling

scale with xfactor = 2.0 and yfactor = 2.0


original mixed scaling

scale with xfactor = 0.5 and yfactor = 0.5


original mixed scaling

scale with xfactor = 0.5 and yfactor = 2.0


original mixed scaling

scale with xfactor = 2.0 and yfactor = 0.5


Thomas Jeffersonpixelated Thomas Jefferson

pixelation