Lossy and Lossless

  • lossy data can reduce data but the original data is not recovered.
  • lossless data lets you restore and recover
    For example, a image's size can be compress by reducing bits and loss some data

Data Compression

Data compression is the reduction of the number of bits needed to represent data and reduce the transmission time.

Describe some of the meta data and considerations when managing Image files. Describe how these relate to Data Compression

Some meta datas when managing the image file are the file name and file type, file size, created data/time, etc. The file size will decrease when the file compres. Also different flle type will affect the size of data.

Questions

  • What are commands you use in terminal to access files?
    I use code to open a file in vs code terminal
  • What are the command you use in Windows terminal to access files?
    I use dir to access file in windows terminal
  • What are some of the major differences?
    The command is different.
  • Why is path a big deal when working with images?
    The file can be hidden in subfolders inside subfolders so a path needs to be specified in order for the computer to find the file. Also, there can be file with the same name inside different subfolders inside a folder.
  • How does the meta data source and label relate to Unit 5 topics?
    The license we mensioned in unit 5 topic is a type of meta data. Meta data also include informations that allows you to determine if a software or website is safe.
  • Look up IPython, describe why this is interesting in Jupyter Notebooks for both Pandas and Images?
    Interative python is a shell for interactive computing
from IPython.display import Image, display # import the IPython library
from pathlib import Path  # https://medium.com/@ageitgey/python-3-quick-tip-the-easy-way-to-deal-with-file-paths-on-windows-mac-and-linux-11a072b58d5f

# prepares a series of images
def image_data(path=Path("images/"), images=None):  # path of static images is defaulted
    if images is None:  # default image
        images = [
            {'source': "Internet", 'label': "Smile face", 'file': "Capture15.jpg"},

        ]
    for image in images:
        # File to open
        image['filename'] = path / image['file']  # file with path
    return images

def image_display(images):
    for image in images:  
        display(Image(filename=image['filename']))


# Run this as standalone tester to see sample data printed in Jupyter terminal
if __name__ == "__main__":
    # print parameter supplied image
    green_square = image_data(images=[{'source': "Internet", 'label': "Green Square", 'file': "Capture15.jpg"}])
    image_display(green_square)
    
    # display default images from image_data()
    default_images = image_data()
    image_display(default_images)

hacks

Two images with lossy and lossless compression

  • PNG(lossless compression)
  • JEPG(lossy compression)

Quiz Reflection

I got all answers correct