Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Spaces
Quick Search
Help
Online Help
Keyboard Shortcuts
Feed Builder
What’s new
Available Gadgets
Log In
People
Zena Abulhab
Pages
Home
Zena Abulhab CS151 - Computational Thinking: Visual Media
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
Colour picker
More colours
Formatting
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Task list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
Task List
tinymce.confluence.insert_menu.macro_desc
User Mention
JIRA Issue
Info
Status
Gallery
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>For this project, the goal was to control entire images within a canvas, moving them around and providing different pieces of information about them such as which filter to use and whether or not the background should be there. Using various functions to manipulate image placement and other factors, we were able to make collages.<br /> Task 1 consisted of making a function for getting information for each index in the collage image list and testing it for feedback. This meant that first, a list of images was made, and within the lists in that, we had a list of parameters for the image: filename, x offset, y offset, filter, alpha blend, background visibility (added later), and the pixmap file itself. Initially, each such index was given a value representing its index so that later, we could simply change the value of the parameters without having to change every instance of the parameter itself. I tested the function using the provided "testbuildcollage.py", which inputs a set of parameters and prints the values so we know that build collage is storing the correct data.</p> <p>For Tasks 2-3, we had to create a function in our filter file that would place a picture into the bigger pixmap without including a background. Within said function, the width and height of the image was first obtained using for loops. Next, the alpha blend option (which blends two images together for an overlapping effect) was anticipated using variable assignment; (r1,g1,b1) was a given pixel in the image, (r2,g2,b2) was one ?the distance away of the x offset and y offset, and new rgb values were assigned to rnew, gnew, and bnew. To check if no background is wanted, however, the function uses an if-else statement, e.g. if the value provided for the index IDXbkg is True, place the image using placepixmapNoBkg, and if it is False, place it using placePixmap.This is illustrated in the code snippet below:</p> <p> <img class="confluence-embedded-image" width="300" src="/download/attachments/423330661/Screen%20Shot%202015-10-20%20at%2011.34.56%20PM.png?version=1&modificationDate=1550895502467&api=v2" data-image-src="/download/attachments/423330661/Screen%20Shot%202015-10-20%20at%2011.34.56%20PM.png?version=1&modificationDate=1550895502467&api=v2" data-linked-resource-id="423232317" data-linked-resource-type="attachment" data-linked-resource-default-alias="Screen Shot 2015-10-20 at 11.34.56 PM.png" data-base-url="https://wiki.colby.edu" data-linked-resource-container-id="423330661" title="null > Screen Shot 2015-10-20 at 11.34.56 PM.png"><br /> In Task 4, the first real image was actually assembled. This just meant making a new file with a function that would carry out all the steps to making a picture, then saving it. After, it could be viewed through show.py. Basically, the list is assembled within the function, then its information is passed along to the readImages and buildCollage functions. The images below show the function and the resulting image.</p> <p> <img class="confluence-embedded-image" width="300" src="/download/attachments/423330661/Screen%20Shot%202015-10-20%20at%2011.42.58%20PM.png?version=1&modificationDate=1550895502467&api=v2" data-image-src="/download/attachments/423330661/Screen%20Shot%202015-10-20%20at%2011.42.58%20PM.png?version=1&modificationDate=1550895502467&api=v2" data-linked-resource-id="423232316" data-linked-resource-type="attachment" data-linked-resource-default-alias="Screen Shot 2015-10-20 at 11.42.58 PM.png" data-base-url="https://wiki.colby.edu" data-linked-resource-container-id="423330661" title="null > Screen Shot 2015-10-20 at 11.42.58 PM.png"><br /> <img class="confluence-embedded-image" width="300" src="/download/attachments/423330661/Screen%20Shot%202015-10-19%20at%209.40.11%20PM.png?version=1&modificationDate=1550895502608&api=v2" data-image-src="/download/attachments/423330661/Screen%20Shot%202015-10-19%20at%209.40.11%20PM.png?version=1&modificationDate=1550895502608&api=v2" data-linked-resource-id="423232320" data-linked-resource-type="attachment" data-linked-resource-default-alias="Screen Shot 2015-10-19 at 9.40.11 PM.png" data-base-url="https://wiki.colby.edu" data-linked-resource-container-id="423330661" title="null > Screen Shot 2015-10-19 at 9.40.11 PM.png"></p> <p>Task 5 was essentially the same, except this time, user input was required. The only difference was the images and their locations and the first item in the collage image list having the input filename be assigned to it. The program would require the name of a .ppm-format image, retrieved from the sys.argv list. The resulting image is shown below.</p> <p><img class="confluence-embedded-image" width="300" src="/download/attachments/423330661/Screen%20Shot%202015-10-19%20at%209.37.16%20PM.png?version=1&modificationDate=1550895502654&api=v2" data-image-src="/download/attachments/423330661/Screen%20Shot%202015-10-19%20at%209.37.16%20PM.png?version=1&modificationDate=1550895502654&api=v2" data-linked-resource-id="423232321" data-linked-resource-type="attachment" data-linked-resource-default-alias="Screen Shot 2015-10-19 at 9.37.16 PM.png" data-base-url="https://wiki.colby.edu" data-linked-resource-container-id="423330661" title="null > Screen Shot 2015-10-19 at 9.37.16 PM.png"><br /> I also did extensions 2 and 5. For extension 2, I needed to make some kind of way for the program to tell if the background color was blue or green so it could remove it using the placePixmapNoBkg function. This required, first, a new index to be added to the lists, and also, the buildCollage function to be altered; if no background was requested and the green background variable was given (set if the swapRedBlue filter was not applied), then green would be taken out, and the same was done for blue, except it would mean that the red-blue switch filter was applied. In the placePixmapNoBkg function, I also simply swapped around the values of red and blue to change which color was to be specified as the background. The result is shown below: <img class="confluence-embedded-image" height="300" src="/download/attachments/423330661/Screen%20Shot%202015-10-19%20at%208.32.53%20PM.png?version=1&modificationDate=1550895502686&api=v2" data-image-src="/download/attachments/423330661/Screen%20Shot%202015-10-19%20at%208.32.53%20PM.png?version=1&modificationDate=1550895502686&api=v2" data-linked-resource-id="423232322" data-linked-resource-type="attachment" data-linked-resource-default-alias="Screen Shot 2015-10-19 at 8.32.53 PM.png" data-base-url="https://wiki.colby.edu" data-linked-resource-container-id="423330661" title="null > Screen Shot 2015-10-19 at 8.32.53 PM.png"><br /> For extension 5, I made it so however many images given in the command line would be assembled to make a collage according to a preset list with the coordinates, filters, and everything except for the image file. The code is displayed below; I mostly used if statements to achieve my goal.<br /> <img class="confluence-embedded-image" width="300" src="/download/attachments/423330661/Screen%20Shot%202015-10-20%20at%2011.58.10%20PM.png?version=1&modificationDate=1550895502342&api=v2" data-image-src="/download/attachments/423330661/Screen%20Shot%202015-10-20%20at%2011.58.10%20PM.png?version=1&modificationDate=1550895502342&api=v2" data-linked-resource-id="423232315" data-linked-resource-type="attachment" data-linked-resource-default-alias="Screen Shot 2015-10-20 at 11.58.10 PM.png" data-base-url="https://wiki.colby.edu" data-linked-resource-container-id="423330661" title="null > Screen Shot 2015-10-20 at 11.58.10 PM.png"></p> <p>Overall, this project taught me a lot about making and manipulating lists and tracing user input in the command line. I also learned how to place images within other images.</p> <p>Worked with: Prof. Maxwell</p>
Attachments
Labels
Location
Edit
Preview
Save
Cancel
Next hint
search
attachments
weblink
advanced