Module 4 – JavaScript Conditional Statements

The assignment was in two parts – write JavaScript that tested two conditions with AND in an if statement, and save an image in different formats to see how they compared.

The webpage with the JavaScript and images is here:

http://jered.0fees.us/module4/

The JavaScript was similar to working with if/else statements in other languages, apart from the loose typing – being able to toss a number and a string into the same variable, for example, then test them, was different from Java. I also put the test into a function and called it twice, for fun.

For the image, I took a large JPG file, reduced the dimensions to 1022×576, then converted it to GIF, JPG, PNG 8-bit, and PNG 24-bit. The 24-bit PNG was the largest file at 905k, the 8-bit PNG was the smallest at 259k, and the GIF and JPG were close to each other in size – 361k and 367k, respectively.

The image quality of the resulting images was pretty similar to my naked eye. At first glance, the images aren’t too different.

Looking closely, the GIF image’s limited number of colors don’t handle shadows and shades of white very well – there isn’t a smooth progression from one shade to the next. The eyes on the pottery especially have that problem.

The other three formats looked similar to each other. I expected the 8-bit PNG to look more like the GIF file, but I wasn’t able to pick out significant differences between it and the JPG and PNG-24, to be honest.

This entry was posted in Web Design Technologies. Bookmark the permalink.

Comments are closed.