Join Todd McLeod for an in-depth discussion in this video Working with images, part of Code Clinic: Go.
- The first step in figuring out the solution is to first…open a file and then once we have a file opened,…we're going to decode it,…so that we can get the image data out of it.…And then after that, I'm going to show you some…file info, which is one of the steps I took…in putting my solution together.…Didn't turn out to really help me, but I thought…I'd leave it in so you could see it.…So the first thing we do is we open a file,…we use os.Open to do that.…It gives us a pointer to a file.…We have to defer closing that file.…Because we've opened a file, we want to make sure…it closes, and we use defer to do that.…
And if we just print this out, we get the address…to the file because it's a pointer to a file,…the address where the file information is kept.…So we do go run main.go.…We see the pointer to the file; we've already seen all that.…The next we do is now that we have our file open,…we want to read the data for that file.…So I use ioutil.ReadAll,…and iouti.ReadAll takes a reader.…I want to take a moment and just revisit how…
Todd introduces challenges and then provides overviews of his solutions in Go. Challenges include topics such as statistical analysis, searching directories for images, and accessing peripheral devices.
Skill Level Beginner
The files have moved, and I can't access them via HTTP as shown in the course.
1. Problem 1—Exploring Lake Pend Oreille
2. Problem 2—Image Analysis
3. Problem 3—Eight Queens
4. Problem 4—Accessing Peripherals
5. Problem 5—Recursion and Directories
6. Problem 6—Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.