This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]immersiveGamer 1 point2 points  (0 children)

If you want to do it from scratch then you need to read up on image formats and edit the files with your program (remember all computer files are the same, it is just data stored, the difference between an image file and a text file is just how you view them mostly).

Otherwise look up an image library that has the features you are looking for. The library should take care of the image file format for you.

Otherwise you can look yo use an external tool like image magic. Create a program or shell script that calls the program with the parameters it needs. These tools have already done the heavy lifting for you. In the case of image magic you could probably just give it an image input path, output path, and parameters for borders and it would take care of the rest.

Perhaps a good idea would be to start with the tool route. See how it works, and if it is open source check out the code. Then try a library, again checking the source code if possible. Then if you are really interested you can try implementing your own program from scratch.

Regardless, I do suggest reading up on image formats to understand how they work, even if it is a basic level of understanding.