Ever since I advanced beyond the “hello worlds” of Java, I had never stopped coding. This section is for documenting code usages that I had employed while solving the technological problems that I had encountered.

How to use Python 3 Pillow on Raspbian Stretch Lite to compress your jpeg image

When you are building a Raspberry Pi camera project, you may want to compress the images captured from the camera to reduce the time to upload your image to a server endpoint. Moreover, when you connect your Raspberry Pi to your iPhone Personal WiFi hotspot, you will want to incur minimal mobile bandwidth charges from demonstrating your Raspberry Pi project in your class.

You may have either:

In this case, you will have the option to use Pillow, a fork of Python Imaging Library, to compress your jpeg image.


Flexible CSS rule-sets to keep your images within their parent element

Since an image is worth a thousand words, we use images in your webpage to express complex ideas succinctly.

By default, if we do not specify any dimensions for an image, most browsers will show the image according to its actual size. In this situation, an image will appear to spill over the boundaries of its parent element if it is bigger.

For example, the following screenshot shows the image at spilling over its parent element:

Example of large image overspilling the parent container

One way to prevent a larger image from going beyond the boundaries of its parent element is to give a standard width to all images. However, if the actual width of an image is smaller than the given width, the image will be stretched:

Example of small image being stretched to fill parent container

This post shows the CSS rule-sets that you can use for flexibly keeping images within their parent element.

How to upload a file and some data through HTTP multipart in Python 3 using the requests library

Undeniably, the HTTP protocol had become the dominant communication protocol between computers.

For example, when we want to upload a file and some data from to a HTTP server, we do so through a HTTP multipart request.

So how can we do that in Python? In Python 3, we can use the services of the requests library to help us construct HTTP multipart request easily.

In case you need it, this is how to upload a file and some data through HTTP multipart in Python 3 using the requests library.

Programming languages that you can use to build applications for Raspberry Pi, via Raspbian Stretch Lite

A programming language give programmers an interface to create computer applications to serve different use cases. On the other hand, a Raspberry Pi is one of the things that a programmer should consider getting.

Raspbian Stretch Lite is the official operating system for programmers to run server applications on a Raspberry Pi. You can use Raspbian Stretch Lite for applications that do not require a graphical user interface.

So what programming languages can you use for building applications for Raspbian Stretch Lite?

This post discusses some programming languages that you can use for building applications for Raspbian Stretch Lite.