Skip to content

Instantly share code, notes, and snippets.

@robsbots
Created May 25, 2014 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robsbots/cb1d047eb286e1f07e6d to your computer and use it in GitHub Desktop.
Save robsbots/cb1d047eb286e1f07e6d to your computer and use it in GitHub Desktop.
loop A: loop over old_file_height // looping over each scan line in original file
loop B:
read each rgb-triple into an array // Read each pixel value in a complete scanline into an array
end loop B
skip over padding at end of scanline
loop C: loop n times // Set up a loop. loop resize times. Write the complete scan line n times.
loop D: loop trough pixel array // read each pixel from the array we just read.
Write pixel resize times.// Write the pixel out resize times.
end of loop D
write end of line padding // write new padding required for this scan line
end of loop D // go back and write the same pixel array for the next line
end of loop A // We have written each pixel n times, and each scanline n times, we have resized the file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment